你好,我的名字是賈馬爾。 我來自馬來西亞,我真的對編寫 JSL 腳本一無所知。 所以我的項目是,我從數據 Wafer 打開的每個表都帶有不需要的行和列。 所以我的目標是,數據只有在名稱行參數和其他是新列時才有效。 我還必須刪除一些我沒有使用的特定行。 所以我的問題是向專家腳本編寫的。 你能寫下,如果我選擇任何數據表它會自動刪除紅色標記內的另一行並將行參數作為新列的程序嗎?
P/s 並非每個數據表都有相同的行參數 (44)
這可能會奏效:
Names Default to Here( 1 );
dt = Current Data Table();
loc = Contains( Column( dt, 1 ) << Get Values, "Parameter" );
dt << Select Rows( 1::loc - 1 ) << Delete Rows;
loc = Contains( Column( dt, 1 ) << Get Values, "PID-1" );
dt << Select Rows( 2::loc - 1 ) << Delete Rows;
For( i = 1, i <= N Col( dt ), i++,
Column( dt, i ) << Set Name( Column( dt, i )[1] )
);
dt << Select Rows( [1] ) << Delete Rows
這是我處理這個問題的方式。在 JMP 中打開 csv 文件,然後運行以下腳本。它將全局數據加載到表變量中,更改列名,然後將測試列轉換為數字等。
Names Default To Here( 1 );
dt = Current Data Table();
// Add Global info as table variables
theRow = 1;
While( Column( dt, 1 )[theRow] != "Parameter",
If( Column( dt, 2 )[theRow] != "",
dt << new table variable( Column( dt, 1 )[theRow],
Column( dt, 2 )[theRow]
)
);
theRow++;
);
// Get rid of unwanted rows
dt << select where( As Column( dt, 3 ) == "" & As Column( dt, 4 ) == "" );
dt << delete rows;
// Rename columns
theRow = (dt << get rows where( As Column( dt, 1 ) == "Parameter" ))[1];
For( i = 1, i <= N Cols( dt ), i++,
If( Column( dt, i )[theRow] != "",
Column( dt, i ) << set name( Column( dt, i )[theRow] )
)
);
dt << delete rows(theRow);
// Attempt to set meta data for columns
// List of know columns
metaList = {
"SBIN", "numeric", "ordinal",
"HBIN", "numeric", "ordinal",
"DIE_X", "numeric", "ordinal",
"DIE_Y", "numeric", "ordinal",
"SITE", "numeric", "ordinal",
"TOTAL_TESTS", "numeric", "continuous",
"X", "numeric", "ordinal",
"Y", "numeric", "ordinal",
"SITE_NO", "numeric", "ordinal",
"PassFail", "numeric", "ordinal",
"TimeStamp", "numeric", "timestamp",
"PartSN", "character", "nominal"
};
// Process metaList into separate lists for easier processing
colList = {};
typeList = {};
modelList = {};
For( i = 1, i <= N Items( metaList ), i++,
If(
Mod( i, 3 ) == 1, Insert Into( colList, metaList[i] ),
Mod( i, 3 ) == 2, Insert Into( typeList, metaList[i] ),
Insert Into( modelList, metaList[i] )
)
);
For( i = 1, i <= N Cols( dt ), i++,
foundName = Contains( colList, Column( dt, i ) << get name );
If(
foundName,
If(
Contains( {"ordinal", "nominal", "continuous"}, modelList[foundName] ),
Column( dt, i ) << dataType( typeList[foundName] ) << modelingtype( modelList[foundName] ),
modelList[foundName] == "timestamp",
For( k = 1, k <= N Rows( dt ), k++,
Column( dt, i )[k] = Word( 1, Char( Column( dt, i )[k] ), "_ " ) || "/" || Word( 2, Char( Column( dt, i )[k] ), "_ " ) || "/"
|| Word( 3, Char( Column( dt, i )[k] ), "_ " ) || " " || Word( 2, Char( Column( dt, i )[k] ), " " )
);
Column( dt, i ) << datatype( numeric ) << modelingtype( continuous ) << set informat( "y/m/d h:m:s" ) <<
Format( "y/m/d h:m:s", 18, 0 );,
),
Is Missing( Num( Column( dt, i )[1] ) ) == 0,
Column( dt, i ) << datatype( numeric ) << modelingtype( continuous );
);
);