열을 행으로 바꾸는 JSL 스크립트시작하는 방법을 잘 모르겠습니다. 선택한 특정 열을 행으로 자동으로 바꾸는 스크립트를 사용하고 싶습니다.
수동으로 수행하는 방법을 알고 있지만 수백 개의 데이터 파일에 대해 매우 반복적 인 작업이므로 스크립트가 필요합니다.
데이터 샘플 및 원하는 결과는 첨부 된 jmp 파일을 참조하십시오.
나는 정말로 당신의 도움에 감사 할 것입니다
데이터 테이블스크립팅Re : 열을 행으로 바꾸는 JSL 스크립트아래 스크립트는 요청한 출력 테이블을 만드는 좋은 시작입니다.
Names Default To Here( 1 );
dt = Current Data Table();
// Transpose the Demographics
dtTrans1 = dt << Transpose(
columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
Transpose selected rows only( 1 ),
Output Table( "Transpose 1" )
);
// Change the name of the first column
dtTrans1:Label << set name( "Column 1" ) << Set Display Width( 150 );
// Change the new column names
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i ) << set name( "Column " || Char( i + 4 ) ) << Set Display Width( 100 )
);
// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 << get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";
// Create the Devce values
deviceRow = (dtTrans1 << get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i )[deviceRow] = i - 1
);
// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i <= N Cols( dt ), i++,
If( Is Missing( Num( Word( 1, Column( dt, i ) << get name, ":" ) ) ) == 0,
Insert Into( parameterColNamesList, Column( dt, i ) << get name )
)
);
// Transpose the parameter columns
dtTrans2 = dt << Transpose(
columns( Eval( parameterColNamesList ) ),
Transpose selected rows only( 0 ),
Output Table( "Transpose 2" )
);
// Add in the new columns to be created
dtTrans2 << Add Multiple Columns( "Column", 5, before first, Character );
// Add the values to the new columns
For( i = 1, i <= N Rows( dtTrans2 ), i++,
dtTrans2:Column 1[i] = Word( 1, dtTrans2:Label[i], ":" );
dtTrans2:Column 2[i] = Word( 2, dtTrans2:Label[i], ":" );
specs = Column( dt, dtTrans2:Label[i] ) << get property( "spec limits" );
If( Is Missing( specs["LSL"] ) == 0,
dtTrans2:Column 3[i] = specs["LSL"]
);
If( Is Missing( specs["USL"] ) == 0,
dtTrans2:Column 4[i] = specs["USL"]
);
If( Column( dt, dtTrans2:Label[i] ) << get property( "Units" ) != "",
dtTrans2:Column 5[i] = Column( dt, dtTrans2:Label[i] ) << get property( "Units" )
);
);
// Get rid of the label column which is no longer needed
dtTrans2 << delete columns( :Label );
// Change the names of the Trans2 table to match the names in the Trans1 table
For( i = 6, i <= N Cols( dtTrans2 ), i++,
Column( dtTrans2, i ) << set name( "Column " || Char( i ) )
);
// Combine the 2 Transformed data tables
dtFinal = dtTrans1 << concatenate( dtTrans2 );
// Cleanup the no longer needed data tables
close( dtTrans1, nosave );
close( dtTrans2, nosave );Re : 열을 행으로 바꾸는 JSL 스크립트감사합니다! 이것은 잘 작동하는 것 같습니다. 그러나 어떤 이유로 테스트 이름 Lo Limit 및 Hi 한계 열이 마지막에 배치됩니다. 우리가 그들을 재 배열하고 스크립트에서 레이블을 붙일 수있는 방법은 없습니까?

Re : 열을 행으로 바꾸는 JSL 스크립트어떤 버전의 JMP를 사용하고 있습니까?Re : 열을 행으로 바꾸는 JSL 스크립트jmp 14를 사용하는 메신저
Re : 열을 행으로 바꾸는 JSL 스크립트다음은 올바른 위치에 사양 열 등을 배치하고 열 레이블에 추가하는 수정 된 버전의 스크립트입니다.
Names Default To Here( 1 );
dt = Current Data Table();
// Transpose the Demographics
dtTrans1 = dt << Transpose(
columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
Transpose selected rows only( 1 ),
Output Table( "Transpose 1" )
);
// Change the name of the first column
dtTrans1:Label << set name( "Column 1" ) << Set Display Width( 150 );
// Change the new column names
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i ) << set name( "Column " || Char( i + 4 ) ) << Set Display Width( 100 )
);
// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 << get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";
// Create the Devce values
deviceRow = (dtTrans1 << get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i )[deviceRow] = i - 1
);
// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i <= N Cols( dt ), i++,
If( Is Missing( Num( Word( 1, Column( dt, i ) << get name, ":" ) ) ) == 0,
Insert Into( parameterColNamesList, Column( dt, i ) << get name )
)
);
// Transpose the parameter columns
dtTrans2 = dt << Transpose(
columns( Eval( parameterColNamesList ) ),
Transpose selected rows only( 0 ),
Output Table( "Transpose 2" )
);
// Add in the new columns to be created
dtTrans2 << Add Multiple Columns( "Column", 5, before first, Character );
// Add the columns 2-5 in the trans data table
dtTrans1 << Add Multiple Columns( "xColumn", 4,after(:Column 1), Character );
for(i=2,i<=5,i++,
column(dtTrans1,i)<<SET name=""></SET>Re : 열을 행으로 바꾸는 JSL 스크립트고마워 짐! 형식이 완벽합니다. 그러나 어떤 이유로 다른 유사한 데이터 세트에서는 작동하지 않습니다. 이유는 무엇입니까?
Re : 열을 행으로 바꾸는 JSL 스크립트로그에 오류 메시지가 있습니까?
두 데이터 테이블의 차이점은 무엇입니까?
완료되기 전에 스크립트가 중지됩니까?
Re : 열을 행으로 바꾸는 JSL 스크립트로그 오류가 없습니다. 스크립트를 실행하면 아무 작업도하지 않습니다. 유일한 차이점은 테스트 이름입니다 ... 그들은 다릅니다. 그러나 다른 모든 헤더는 동일합니다.Re : 열을 행으로 바꾸는 JSL 스크립트1 행부터 26 행까지의 코드를 실행 해보십시오. 스크립트에서 해당 행을 선택 (강조 표시) 한 다음 실행 아이콘을 클릭하기 만하면됩니다.
Names Default To Here( 1 );
dt = Current Data Table();
// Transpose the Demographics
dtTrans1 = dt << Transpose(
columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
Transpose selected rows only( 1 ),
Output Table( "Transpose 1" )
);
// Change the name of the first column
dtTrans1:Label << set name( "Column 1" ) << Set Display Width( 150 );
// Change the new column names
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i ) << set name( "Column " || Char( i + 4 ) ) << Set Display Width( 100 )
);
// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 << get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";
// Create the Devce values
deviceRow = (dtTrans1 << get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i )[deviceRow] = i - 1
);
Transpose 1 데이터 테이블이 다음과 같은지 확인하십시오.

실행 라인 30-35
parameterColNamesList = {};
For( i = 1, i <= N Cols( dt ), i++,
If( Is Missing( Num( Word( 1, Column( dt, i ) << get name, ":" ) ) ) == 0,
Insert Into( parameterColNamesList, Column( dt, i ) << get name )
)
);
그리고 parameterColNamesList에 데이터 테이블의 모든 테스트 이름이 포함되어 있는지 확인합니다.
그런 다음 올바르게 실행되지 않는 항목을 찾을 때까지 코드의 다른 섹션을 계속 확인하십시오.
읽으려는 데이터 테이블의 사본을 제게 제공 할 수 있다면 제가 직접 확인을하겠습니다.
Re : 열을 행으로 바꾸는 JSL 스크립트네, 여기 있습니다
Re : 열을 행으로 바꾸는 JSL 스크립트여기에 무작위 샘플 데이터가 있습니다.
Re : 열을 행으로 바꾸는 JSL 스크립트이전 샘플을 무시하고이 샘플을 사용하십시오.
Re : 열을 행으로 바꾸는 JSL 스크립트여기 하나입니다
Re : 열을 행으로 바꾸는 JSL 스크립트문제는 하나 이상의 매개 변수가 문자 데이터로 입력되었다는 것입니다.Transpose는 혼합 데이터를 처리 할 수 없습니다.그래서 감지 된 모든 매개 변수가 숫자인지 확인하는 검사를 추가했습니다.
Names Default To Here( 1 );
dt = Current Data Table();
// Transpose the Demographics
dtTrans1 = dt << Transpose(
columns( :SBIN, :HBIN, :Alarms, :Device, :Site ),
Transpose selected rows only( 1 ),
Output Table( "Transpose 1" )
);
// Change the name of the first column
dtTrans1:Label << set name( "Column 1" ) << Set Display Width( 150 );
// Change the new column names
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i ) << set name( "Column " || Char( i + 4 ) ) << Set Display Width( 100 )
);
// Change the detail name of the Alarms
dtTrans1:Column 1[(dtTrans1 << get rows where( dtTrans1:Column 1 == "Alarms" ))[1]] = "Pass/Fail/Alarm";
// Create the Devce values
deviceRow = (dtTrans1 << get rows where( dtTrans1:Column 1 == "Device" ))[1];
For( i = 2, i <= N Cols( dtTrans1 ), i++,
Column( dtTrans1, i )[deviceRow] = i - 1
);
// Now Find all of the columns that are parameters
parameterColNamesList = {};
For( i = 1, i <= N Cols( dt ), i++,
If( Is Missing( Num( Word( 1, Column( dt, i ) << get name, ":" ) ) ) == 0,
Insert Into( parameterColNamesList, Column( dt, i ) << get name )
)
);
// Transpose the parameter columns
dtTrans2 = dt << Transpose(
columns( Eval( parameterColNamesList ) ),
Transpose selected rows only( 0 ),
Output Table( "Transpose 2" )
);
// Add in the new columns to be created
dtTrans2 << Add Multiple Columns( "Column", 5, before first, Character );
// Add the columns 2-5 in the trans data table
dtTrans1 << Add Multiple Columns( "xColumn", 4,after(:Column 1), Character );
for(i=2,i<=5,i++,
column(dtTrans1,i)<<SET name=""></SET>Re : 열을 행으로 바꾸는 JSL 스크립트감사합니다 jim하지만 몇 가지 이유로 업데이트 된 스크립트와 동일한 오류가 있습니다.

Re : 열을 행으로 바꾸는 JSL 스크립트내 오류 .... 실수로 내가 보낸 마지막 항목에 수정 사항이 없습니다. 마지막 응답을 편집하고 JSL을 업데이트했습니다. 돌아가서 JSL을 당겨 실행하십시오. 이제 수정 된 코드가 포함됩니다.