Ich habe mit JMP Query Builder ein Skript erstellt, das 2 Tabellen zusammenführen soll. Das funktioniert auch gut. Jedoch wenn ich das Skript modifiziere, verliert es den ursprünglichen Bezug, was Tabelle 1 und was 2 war.
Das Problem ist Zeile 209 im Skript. Es bleibt an dieser Stelle immer hängen und findet die beiden Tabellen nicht.
Names Default To Here( 1 );
//Select file: 1st: Adj & 2nd: Align
myAdj = Pick File(
"Select JMP File",
"...\Adj.xlsx"
);
myAlign = Pick File(
"Select JMP File",
"Align.xlsx");
// Open xlsx Files and import to JMP
exAdj = Open(
myAdj,
invisible,
Worksheets( "Tabelle1" ),
Use for all sheets( 1 ),
Concatenate Worksheets( 0 ),
Create Concatenation Column( 0 ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Number of Rows in Headers( 1 ),
Headers Start on Row( 1 ),
Data Starts on Row( 2 ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Replicated Spanned Headers( 0 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 ),
Multiple Series Stack( 0 ),
Import Cell Colors( 0 ),
Limit Column Detect( 0 ),
Column Separator String( "-" ),
Column Numeric Format( Index( 0 ), Column Name( ID ), Format( "Best", 9 ) )
)
);
exAdj << new column("TestRun_max", "numeric", "contiuous", Formula(If( :TestRun == Col Maximum( :TestRun, :ProductionNumber ),
1,
0
) ));
exAdj:SerialNumber << Set Data Type( "Character" );
exAdj:SerialNumber << set modeling type ("nominal");
exAdj:ProductionNumber << Set Data Type( "Character" );
exAdj:ProductionNumber << set modeling type ("nominal");
exAdj << select where( :TestRun_max != 1);
exAdj << wait();
exAdj << delete rows;
exAdj << select where(is missing(:TestRun));
exAdj << wait();
exAdj << delete rows;
exAdj << set name("Adj");
exAlign = Open(
myAlign,
invisible,
Worksheets( "Tabelle1" ),
Use for all sheets( 1 ),
Concatenate Worksheets( 0 ),
Create Concatenation Column( 0 ),
Worksheet Settings(
1,
Has Column Headers( 1 ),
Number of Rows in Headers( 1 ),
Headers Start on Row( 1 ),
Data Starts on Row( 2 ),
Data Starts on Column( 1 ),
Data Ends on Row( 0 ),
Data Ends on Column( 0 ),
Replicated Spanned Rows( 1 ),
Replicated Spanned Headers( 0 ),
Suppress Hidden Rows( 1 ),
Suppress Hidden Columns( 1 ),
Suppress Empty Columns( 1 ),
Treat as Hierarchy( 0 ),
Multiple Series Stack( 0 ),
Import Cell Colors( 0 ),
Limit Column Detect( 0 ),
Column Separator String( "-" ),
Column Numeric Format( Index( 0 ), Column Name( ID ), Format( "Best", 9 ) )
)
);
exAlign << new column("TestRun_max", "numeric", "contiuous", Formula(If( :TestRun == Col Maximum( :TestRun, :ProductionNumber ),
1,
0
) ));
exAlign:SerialNumber << Set Data Type( "Character" );
exAlign:SerialNumber << set modeling type ("nominal");
exAlign:ProductionNumber << Set Data Type( "Character" );
exAlign:ProductionNumber << set modeling type ("nominal");
exAlign << select where( :TestRun_max != 1);
exAlign << wait();
exAlign << delete rows;
exAlign << select where(is missing(:TestRun));
exAlign << wait();
exAlign << delete rows;
exAlign << set name("Align");
New SQL Query(
Version( 130 ),
Connection( "JMP" ),
JMP Tables(
exAlign,
exAdj
),
QueryName( "OptAdj-Align" ),
Select(
Column( "SerialNumber", "t1", Alias( "SerialNumber Allign" ) ),
Column( "SerialNumber", "t2", Alias( "SerialNumber Adj" ) ),
Column( "ProductionNumber", "t1", Alias( "ProductionNumber Allign" ) ),
Column( "ProductionNumber", "t2", Alias( "ProductionNumber Adj" ) ),
Column( "Freipruefung", "t1", Alias( "Freipruefung Allign" ) ),
Column( "Freipruefung", "t2", Alias( "Freipruefung Adj" ) ),
Column(
"TestRun",
"t1",
Alias( "TestRun Allign" ),
Analysis Type( "Ordinal" )
),
Column(
"TestRun",
"t2",
Alias( "TestRun Adj" ),
Analysis Type( "Ordinal" )
),
Column( "TestState", "t1", Alias( "TestState Allign" ) ),
Column( "TestState", "t2", Alias( "TestState Adj" ) ),
Column( "ErrorNumber", "t1", Alias( "ErrorNumber Allign" ) ),
Column( "ErrorUserText", "t1", Alias( "ErrorUserText Allign" ) ),
Column(
"ErrorNumber",
"t2",
Alias( "ErrorNumber Adj" ),
Analysis Type( "Nominal" )
),
Column( "Mode", "t1" ),
Column( "Mode", "t2", Alias( "Mode Adj" ), Analysis Type( "Nominal" ) ),
Column( "WUserName", "t2", Alias( "WUserName Adj" ) ),
Column( "WUserName", "t1", Alias( "WUserName Allign" ) ),
Column(
"DateOfTest",
"t1",
Alias( "DateOfTest Allign" ),
Numeric Format( "d.m.y h:m:s", "0", "NO", "" )
),
Column(
"Month Year[DateOfTest]",
"t1",
Alias( "Month Year[DateOfTest] Allign" ),
Analysis Type( "Ordinal" ),
Numeric Format( "m.y", "-1", "NO", "" )
),
Column(
"Month[DateOfTest]",
"t1",
Alias( "Month[DateOfTest] Allign" ),
Analysis Type( "Ordinal" )
),
Column(
"Year Week[DateOfTest]",
"t1",
Alias( "Year Week[DateOfTest] Allign" )
),
Column(
"Date[DateOfTest]",
"t1",
Alias( "Date[DateOfTest] Allign" ),
Numeric Format( "d.m.y", "-1", "NO", "" )
),
Column(
"DateOfTest",
"t2",
Alias( "DateOfTest Adj" ),
Numeric Format( "d.m.y h:m:s", "0", "NO", "" )
),
Column(
"Date[DateOfTest]",
"t2",
Alias( "Date[DateOfTest] Adj" ),
Numeric Format( "d.m.y", "-1", "NO", "" )
),
Column(
"Month Year[DateOfTest]",
"t2",
Alias( "Month Year[DateOfTest] Adj" ),
Analysis Type( "Ordinal" ),
Numeric Format( "m.y", "-1", "NO", "" )
),
Column(
"Year Week[DateOfTest]",
"t2",
Alias( "Year Week[DateOfTest] Adj" )
),
Column( "OptimalNeuMaß", "t1" ),
Column( "Y_Deviation_Sensor0", "t2" ),
Column( "Y_Deviation_Sensor1", "t2" ),
Column( "Y_Deviation_Sensor3", "t2" ),
Column( "Y_Deviation_Sensor4", "t2" ),
Column( "Y_Deviation_Sensor5", "t2" )
),
From(
Table( "Adj", Alias( "t1" ) ),
Table( "Align", Alias( "t2" ),
Join(
Type( Inner ),
EQ( Column( "SerialNumber", "t1" ), Column( "SerialNumber", "t2" ) )
& EQ(
Column( "ProductionNumber", "t1" ),
Column( "ProductionNumber", "t2" )
)
)
)
),
PostQueryScript(
"dt = current data table();
dt << Row Selection( Select where( :SerialNumber Allign < 500000 ) );
dt << delete rows;"
)
) << run;
close(exAlign);
close(exAdj);
Wo liegt der Fehler?
Danke für eure Hilfe im Voraus!
Markus