프로세스에 대한 입력을 정의하는 임의의 수의 열과 출력 인 다른 열이 있으며 각 입력 집합에 대해 시간에 맞춰 입력되는 출력 행이 있습니다.
.jsl을 사용하여 행 1에서 "1"로 시작하는 새 "setid"열을 만든 다음 사용자가 선택한 열 (1 개 이상)을 사용하고 해당 열의 값이 변경 될 때마다 증가 할 수 있습니까? setid 열의 값-그렇지 않으면 setid가 동일하게 유지됩니다. 행이 세트별로 합리적으로 정렬되었다고 가정 할 수 있습니다.
시작할 수있는 간단한 예가 있습니다. 몇 년 전에했던 오래된 코드를 파헤쳐 서 수정했습니다. 먼저 대화 상자가 나타납니다.

열을 선택한 후 확인을 클릭하면 새 열이 생성됩니다.
스크립팅 가이드를 읽지 않았다면 ..... 지금 그렇게해야합니다. 이 간단한 스크립트를 확장하려면 JSL과이를 사용하여 수행 할 수있는 작업을 이해해야합니다. 다음은 스크립트입니다.
Clear Symbols();
Names Default To Here( 1 );
dt = Current Data Table();
allcolumnslist = dt << get column names( "string" );
nw = New Window( "Generate SETID Column",
Border Box( Left( 3 ), top( 2 ),
V List Box(
Text Box( "Create a SETID Column" ),
H List Box(
V List Box(
// Generate the master display box for the columns in the data table
Panel Box( "Select Columns",
colListData = Col List Box( width( 180 ), nLines( Min( N Cols( dt ), 15 ) ) ),
colListData << append( dt << get column names( "string" ) ),
// At startup, sselect the columns in the selection box for
// the columns that are selected in the data table
For( II = 1, II <= N Items( All Columns list ), II++,
If( Column( ii ) << get selected == 1,
colListData << set selected( II )
)
);
)
),
// Setup the selection buttons and the selection boxes
Panel Box( "Selected Columns to Create SETID from",
Lineup Box( N Col( 2 ), Spacing( 3 ),
Button Box( "Add Column(s)", colListY << Append( colListData << GetSelected ) ),
colListY = Col List Box( width( 180 ), nLines( 10 ), min col( 1 ), max col( 0 ) ),
)
),
// Setup the action buttons that control the window processing
V List Box(
Panel Box( "Action",
Lineup Box( N Col( 1 ),
Button Box( "OK",
// Check to see if the required data has been input
If( N Items( colListY << GetItems ) == 0,
Dialog( "No Y Columns Specified", Button( "OK" ) ),
// Process the Y Columns
thecols = {};
thecols = colListY << GetItems;
nw << close window;
runit();
)
),
Button Box( "Cancel", Stop() ),
Text Box( " " ),
Button Box( "Remove", colListY << RemoveSelected ),
Button Box( "Help", notImplemented )
)
)
),
)
)
)
);
// Here is the function that calculates the new column.
runit = Function( {},
If( Try( dt:SetID << get name, "" ) != "",
dt << delete columns( {"SetID"} )
);
dt << New Column( "SetID", numeric );
// Set the value for row 1
mySetID = 1;
dt:SetID[1] = mySetID;
// Loop across the remaining rows, checking for a change from the previous row
For( i = 2, i <= N Rows( dt ), i++,
thesame = "Yes";
For( k = 1, k <= N Items( thecols ), k++,
If( Column( dt, thecols[k] )[i] != Column( dt, thecols[k] )[i - 1],
thesame = "No"
)
);
// If a change is found, increase the counter
If( thesame == "No",
mySetID
++);
// Set the value of the new column
dt:SetID[i] = mySetID;
);
);