열을 행으로 변환
데이터와 원하는 결과
당신의 도움에 정말 감사하겠습니다
품질 및 프로세스 엔지니어링결과 공유 및 전달Re: 열을 행으로 바꾸는 JSL 스크립트고마워요 짐
Re: 열을 행으로 바꾸는 JSL 스크립트내 오류입니다....실수로 제가 귀하에게 보낸 마지막 항목에 제가 수정한 내용이 없었습니다. 마지막 응답을 편집하고 JSL을 업데이트했습니다. 돌아가서 JSL을 당겨 실행해 보세요. 이제 수정된 코드가 포함되어 있습니다.Re: 열을 행으로 바꾸는 JSL 스크립트Jim에게 감사하지만 어떤 이유로 인해 업데이트된 스크립트에서 여전히 동일한 오류가 발생합니다.

Re: 열을 행으로 바꾸는 JSL 스크립트문제는 하나 이상의 Parameter가 문자 데이터로 입력되었다는 점이었습니다.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 &
Column( dt, i ) << get modeling type == "Continuous",
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 스크립트표시되는 오류 메시지는 "dtTrans2"가 가리키는 데이터 테이블이 생성되지 않음을 나타냅니다."dtTrans2"는 원래 데이터 테이블의 매개변수 목록이 필요한 Transpose()에서 생성됩니다."parameterColNamesList"는 숫자로 시작하고 뒤에 ":"가 오는 원본 데이터 테이블의 모든 열을 찾아서 생성됩니다.귀하의 매개변수 이름이 원본 데이터 테이블에서와 같이 지정되지 않은 것 같습니다.하지만 데이터 테이블을 보지 않고 추측만 할 뿐입니다.제가 추측한 내용이 사실이라면 매개변수 열을 식별하는 항목을 찾아야 합니다.
Re: 열을 행으로 바꾸는 JSL 스크립트안녕하세요 짐
어떤 이유로든 다른 데이터 테이블에서 여전히 문제를 발견했습니다. 데이터 유형을 확인하고 모두 동일한지 확인했습니다. 하지만 작동하지 않습니다

Re: 열을 행으로 바꾸는 JSL 스크립트고마워요 짐
Re: 열을 행으로 바꾸는 JSL 스크립트이 샘플 데이터 테이블에는 기기 열에 문제가 있습니다.문자 데이터 유형으로 설정됩니다.숫자로 변경하면 스크립트가 제대로 작동합니다.
Re: 열을 행으로 바꾸는 JSL 스크립트귀하가 제공한 하위 집합 샘플 데이터에 대해 스크립트를 실행했는데 오류 없이 실행되어 전치된 데이터 테이블이 생성되었습니다.테스트 이름에 입력 데이터 테이블의 전체 이름이 포함되어 있지 않다는 작은 문제를 하나 발견했습니다.하지만 그 외에는 올바르게 실행된 것 같습니다.

다음은 수정된 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 )
)
);
매개변수ColNamesList에 데이터 테이블의 모든 테스트 이름이 포함되어 있는지 확인하세요.
그런 다음 올바르게 실행되지 않는 코드를 찾을 때까지 코드의 다른 섹션을 계속 확인하세요.
읽으려는 데이터 테이블의 사본을 제게 제공해 주시면 제가 직접 확인해 보겠습니다.
Re: 열을 행으로 바꾸는 JSL 스크립트로그 오류가 없습니다. 스크립트를 실행하면 아무 작업도 수행되지 않습니다. 유일한 차이점은 테스트 이름입니다. 서로 다릅니다. 하지만 다른 모든 헤더는 동일합니다.Re: 열을 행으로 바꾸는 JSL 스크립트로그에 오류 메시지가 있습니까?
두 데이터 테이블의 차이점은 무엇입니까?
스크립트가 완료되기 전에 중지됩니까?
Re: 열을 행으로 바꾸는 JSL 스크립트고마워요 짐! 형식이 완벽해요. 그러나 어떤 이유로 다른 유사한 데이터 세트에서는 작동하지 않습니다. 무슨 이유라도?
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 스크립트저는 jmp 14를 사용하고 있어요
Re: 열을 행으로 바꾸는 JSL 스크립트어떤 버전의 JMP를 사용하고 있나요?Re: 열을 행으로 바꾸는 JSL 스크립트감사합니다! 이것은 잘 작동하는 것 같습니다. 그러나 어떤 이유로 테스트 이름 Lo Limit 및 Hi Limit 열이 마지막에 배치됩니다. 어쨌든 우리는 그것들을 재배열하고 스크립트에 라벨을 붙일 수 있습니까?
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 );