Carissimi,
Chiedo il parere di un esperto sul seguente argomento, dal momento che sono davvero nuovo nello scripting di JMP.
Ho effettuato una query SQL (invisibile) tramite il generatore di query ma ho bisogno di aiuto per:
- richiedere all'utente di inserire il file della tabella dati nome (finestra pop-up);
- aggiungi data e ora ( ggmoniyyy:h:m:s ) alla tabella dei dati di output
Quello che sono riuscito a scrivere è qui sotto:
Names Default To Here( 1 );
dt=New SQL Query(
Version( 130 ),
Connection(
"ODBC:DSN=DB001.00.G_FE_JMP15;DBQ=Y:\OFFICIAL_DATABASES\QA_Admin\Stability\DB001.00.G.StabilityStudies_FE_StudiesCompiler_JMP15.accdb;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"
),
QueryName( "Query_DB001.00.G.StabilityStudies_FE_StudiesCompiler_10Jun2021" ),
Select(
Column( "StudyID", "t1" ),
Column( "TimePointID", "t1" ),
Column( "StabilityClimaticConditions", "t1" ),
Column( "TestMonth", "t1" ),
Column( "ProgramComments", "t1" ),
Column( "Test1", "t1" ),
Column( "Test1Specification", "t1" ),
Column( "Test1Units", "t1" ),
Column( "Test 01", "t1" ),
Column( "intTest1", "t1" ),
Column( "Test2", "t1" ),
Column( "Test2Specification", "t1" ),
Column( "Test2Units", "t1" ),
Column( "Test 02", "t1" ),
Column( "intTest2", "t1" ),
Column( "Test3", "t1" ),
Column( "Test3Specification", "t1" ),
Column( "Test3Units", "t1" ),
Column( "Test 03", "t1" ),
Column( "intTest3", "t1" ),
Column( "Test4", "t1" ),
Column( "Test4Specification", "t1" ),
Column( "Test4Units", "t1" ),
Column( "Test 04", "t1" ),
Column( "intTest4", "t1" ),
Column( "Test5", "t1" ),
Column( "Test5Specification", "t1" ),
Column( "Test5Units", "t1" ),
Column( "Test 05", "t1" ),
Column( "intTest5", "t1" ),
From( Table( "qry_ResultsUnion01_35", Alias( "t1" ) ) ),
Where(
EQ(
Column( "StudyID", "t1" ),
_AllRows_,
UI(
Comparison(
Base(
"Continuous",
Prompt(
"StudyID:",
Character,
PromptName( "t1.StudyID_1" )
)
)
)
)
) & In List(
Column( "StabilityClimaticConditions", "t1" ),
_AllRows_,
UI(
SelectListFilter(
ListBox,
Base(
"Categorical",
Prompt(
"StabilityClimaticConditions:",
Character,
PromptName( "t1.StabilityClimaticConditions_1" )
)
)
)
)
)
)
) << Run Background(invisible);
nw = New Window( "Name data table",
<<MODAL></MODAL>Grazie molto,
F
Molto probabilmente l'esecuzione dello script termina prima che il file New Query(.
Prova a eseguire la query in primo piano anziché in background OPPURE usa modal before query per ottenere i valori dall'utente e usa lo script postquery per modificare il nome al termine della query.
Grazie per la tua risposta!
Ho ancora un problema a questo livello:
dt << set name( nw["tableName"] );
Il messaggio di errore che ottengo è qui sotto

Potreste per favore aiutarmi a risolverlo?
Grazie ancora,
F
Prova a cambiare la tua ultima istruzione if in questo, corregge sia il tuo riferimento tableName che rimuove le barre e i due punti che probabilmente stavano causando il tuo problema:
//ask where to save the file (could skip this or define it in code)
fldr = pick directory( "Select where to save the file", "$Temp" );
//Save the file
If( nw["button"] == 1 & nw["tableName"] != "",
dt << set name( nw["tableName"] );
dt << save as( fldr || nw["tableName"] || Format Date( Today(), "yyyymmdd" ) || "-" || Char( Hour( Today() ) ) || Char( Minute( Today() ) ) || Char( Second( Today() ) ) || ".jmp");
);
//Open directory where file was saved (not needed)
Open(fldr);