Hi all,
First time posting so go easy on me 
I would like to join two tables together inside JMP. The first is a data table outputted from a spectrometer, the other is a reference table. The joining keys for the tables don't match exactly so I have added maximum and minimum key columns into the reference table to use in conditions ((if (key > min key) and (key < max key) join other reference table columns to this row).
I have previously used the JMP Query builder to join these together and it works quite well. However I am now wondering if it is possible to integrate the pick file object into this query. Essentially I would like the user to:
- Run the query
- Get a pop-up about which file they would like to analyse
- The query would then run, matching any keys to the reference table where it falls within the minkey - maxkey region.
- The user then gets the input table back, with additional columns where the query has been able to make the join.
I've been mucking around for a couple days and have had no joy. The script below asks for the pick file input, only returns the table, it doesn't attempt to make a join at all.
Any help/guidance is appreciated.
New SQL Query(
Version( 130 ),
Connection( "JMP" ),
JMP Tables(
["Reference Table" =>
"ReferenceTablePath",
"Input Data" =>
Open(
Pick File(
"Select JMP File",
"InputData Directory Path",
{"All Files|*"},
1,
0,
"newJmpFile.jmp"),
columns(
New Column( "Key", Numeric, "Continuous", Format( "Best", 12 ) ),
New Column( "Intensity", Numeric, "Continuous", Format( "Best", 12 ) )
),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, 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( 25 ),
Lines To Read( "All" ),
Year Rule( "20xx" )))]
),
QueryName( "SQLQuery2" ),
Select(
Column( "Key", "t1" ),
Column( "Intensity", "t1" ),
Column( "Value1", "t2" ),
Column( "Value2", "t2" )
),
From(
Table( "Input Data", Alias( "t1" ) ),
Table(
"Reference Table",
Alias( "t2" ),
Join(
Type( Left Outer ),
GE( Column( "Key", "t1" ), Column( "MinKey", "t2" ) ) &
LE( Column( "Key", "t1" ), Column( "MaxKey", "t2" ) )
)
)
)
) << Run