여러 로그 파일을 단일 파일로 연결하려고 하는데 버전 13을 사용하고 있습니다.JMP 14는 훨씬 쉽습니다... 다른 사람들은 한동안 jmp 13을 사용할 것이므로 일반 스크립트를 만들어야 합니다.
현재 내가 가지고 있는 스크립트는 여러 개의 공개 데이터 테이블을 생성할 수 있습니다. 잘 작동합니다.openDT 목록을 반복하고 캡처할 수 있습니다.
그러나 연결하려고 하면 성공하지 못했습니다. 단일 파일로 연결하기 위해 테이블을 열 필요조차 없습니다.
누군가가 이 문제를 이해하는 데 도움을 줄 수 있습니까?
____________________________________________________________________
열린 로그 중 하나에서 연결 기능을 실행하여 다음을 생성했습니다.
Data Table( "test_data_1.log" ) << Concatenate(
Data Table( "test_data_2.log" ),
Data Table( "test_data_3.log" ),
Output Table( "RESULTS" ),
Create source column
);
____________________________________________________
names = {"/C:/1test/test_data_1.log", "/C:/1test/test_data_2.log", "/C:/1test/test_data_3.log"};
openDTs = {DataTable("test_data_3.log"), DataTable("test_data_2.log"), DataTable("test_data_1.log")};
이름이 확인되지 않음: 'Results' , Results/*###*/에 액세스하거나 평가됩니다.
다음 스크립트에서는 /*###*/로 표시된 오류가 있습니다.
dirpath = Munger( Pick Directory( "JMP 13.xx locate the LOG FILES: " ), 1, "/", "" );
Set Current Directory( dirpath );
names = Files In Directory( dirpath, recursive( 1 ) );
For( i = 1, i <= N Items( names ), i++,
dt1 = Open(
names[i] = Convert File Path( dirpath ) || names[i],
columns(
Column( "STARTDATETIME", Numeric, "Continuous", Format( "y/m/d h:m:s", 26, 3 ), Input Format( "y/m/d h:m:s", 3 ) ),
Column( "FIVER", Numeric, "Continuous", Format( "Best", 12 ) ),
Column( "CLASS", Character, "Nominal" ),
Column( "BLANK", Character( 1 ), "Nominal" ),
Column( "TYPE", Character, "Nominal" ),
Column( "CSTARGET", Character, "Nominal" ),
Column( "CSACTION", Character, "Nominal" ),
Column( "NUMCODE", Numeric, "Continuous", Format( "Best", 12 ) ),
Column( "DEVICE", Character, "Nominal" ),
Column( "DATA", Character, "Nominal" ),
Column( "ENDDATE", Numeric, "Continuous", Format( "y/m/d h:m:s", 29, 6 ), Input Format( "y/m/d h:m:s", 6 ) ),
Column( "JUNK1", Numeric, "Continuous", Format( "y/m/d h:m:s", 29, 6 ), Input Format( "y/m/d h:m:s", 6 ) ),
Column( "JUNK2", Numeric, "Continuous", Format( "Best", 12 ) )
),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Other( "0x7c" ), CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 0 ),
Column Names Start( 1 ),
Data Starts( 1 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
Current Data Table( dt1 );
dt1 << delete columns( "CLASS", "FIVER", "BLANK", "JUNK1", "JUNK2" );
dt1 << Select Where(
Contains( As Column( dt1, "TYPE" ), "Execute" ) | Contains( As Column( dt1, "TYPE" ), "++" ) | Contains(
As Column( dt1, "TYPE" ),
"SetState"
) | Contains( As Column( dt1, "TYPE" ), "SAM" ) | Contains( As Column( dt1, "TYPE" ), "DAC" )
);
dt1 << Delete Rows;
);
Show( names );
openDTs = {};
For( i = 1, i <= N Table(), i++,
Insert Into( openDTs, Data Table( i ) )
);
Show( openDTs );
dt = New Table( "Results" );
For( k = 1, k <= N Items( names ), k++,
Current Data Table( Results/*###*/ );
dt << concatenate( Data Table( names[k] ), Output Table( "Results" ), Create Source column );
);Jim - 감사합니다... 정밀 검사를 수행했습니다.... 데이터를 열로 구문 분석하지 않고 파일을 연 다음 소스 열을 추가합니다. 그런 다음 연결하십시오. 그런 다음 연결된 파일을 가져와서 구문 분석합니다. 더 빠르고 논리적인 진행이 가능합니다. 다음을 추가했습니다.
// create the variables to set the column name and
// define the column value
cName = "SOURCE";
fName = dt1 << get name;
dt1 << New Column( cName, Character, Nominal, Set each value( fName ) );
Then iterate the open tables:
// define a list of open data tables.
openDTs = List();
For( i = 1, i <= N Table(), i++,
Insert Into( openDTs, Data Table( i ) )
);
// Loop through the data tables again and concatenate
For( k = 2, k <= N Items( openDTs ), k++,
Current Data Table();
dtUpdated = Current Data Table() << Concatenate( openDTs[k] );
Close( openDTs[k], nosave );
);
지금은 잘 작동하고 있습니다.
현재 데이터 테이블() 함수를 다음으로 변경해야 합니다.
Current Data Table( dt );
또는
Current Data Table( data table( "Results" ) );
그러나 일반적으로 각 파일을 읽을 때 연결을 수행합니다.제가 보기엔 더 깨끗해 보이는데
Names default to here(1);
dirpath = Munger( Pick Directory( "JMP 13.xx locate the LOG FILES: " ), 1, "/", "" );
Set Current Directory( dirpath );
names = Files In Directory( dirpath, recursive( 1 ) );
dt = New Table( "Results" );
For( i = 1, i <= N Items( names ), i++,
dt1 = Open(
names[i] = Convert File Path( dirpath ) || names[i],
columns(
Column( "STARTDATETIME", Numeric, "Continuous", Format( "y/m/d h:m:s", 26, 3 ), Input Format( "y/m/d h:m:s", 3 ) ),
Column( "FIVER", Numeric, "Continuous", Format( "Best", 12 ) ),
Column( "CLASS", Character, "Nominal" ),
Column( "BLANK", Character( 1 ), "Nominal" ),
Column( "TYPE", Character, "Nominal" ),
Column( "CSTARGET", Character, "Nominal" ),
Column( "CSACTION", Character, "Nominal" ),
Column( "NUMCODE", Numeric, "Continuous", Format( "Best", 12 ) ),
Column( "DEVICE", Character, "Nominal" ),
Column( "DATA", Character, "Nominal" ),
Column( "ENDDATE", Numeric, "Continuous", Format( "y/m/d h:m:s", 29, 6 ), Input Format( "y/m/d h:m:s", 6 ) ),
Column( "JUNK1", Numeric, "Continuous", Format( "y/m/d h:m:s", 29, 6 ), Input Format( "y/m/d h:m:s", 6 ) ),
Column( "JUNK2", Numeric, "Continuous", Format( "Best", 12 ) )
),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Other( "0x7c" ), CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 0 ),
Column Names Start( 1 ),
Data Starts( 1 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
Current Data Table( dt1 );
dt1 << delete columns( "CLASS", "FIVER", "BLANK", "JUNK1", "JUNK2" );
dt1 << Select Where(
Contains( As Column( dt1, "TYPE" ), "Execute" ) | Contains( As Column( dt1, "TYPE" ), "++" ) | Contains(
As Column( dt1, "TYPE" ),
"SetState"
) | Contains( As Column( dt1, "TYPE" ), "SAM" ) | Contains( As Column( dt1, "TYPE" ), "DAC" )
);
dt1 << Delete Rows;
dt1 << rerun formulas; // make sure all dt1 operations are complete
// Concatenate to the Results data table
dt << concatenate( dt1, Append to first table( 1 ), Create Source Column );
// To keep the work environment clean, I normally delete the latest input data table
close( dt1, nosave );
);