Il componente aggiuntivo JSON Parser deve essere disponibile nell'ambiente JMP-Live per funzionare sui report pubblicati?Di recente abbiamo creato codice JSL per raccogliere dati da una chiamata API REST. Attualmente sono alla versione 18.01 di JMP.
In sostanza, il nostro sviluppatore di applicazioni ha creato uno scenario in cui per uno specifico reparto di produzione chiamiamo i dati in blocchi "mensili", per ridurre troppo "lavoro pesante". Copriamo 24 mesi di dati a ritroso da oggi. Quindi combiniamo i dati di ogni mese in una tabella dati, quindi eseguiamo la nostra analisi sulla tabella dati completamente popolata.
In definitiva, intendiamo pubblicare questo report su JMP-Live e lì sta il nostro problema. Ho fatto una rapida pubblicazione su JMP-Live dove è utilizzata la chiamata API REST, tuttavia non è riuscita a funzionare, sospetto che sia dovuto al componente aggiuntivo JSON Parser che abbiamo caricato in JMP.
Nel codice sottostante puoi vedere 2 righe critiche in cui entra in gioco il componente aggiuntivo JSON Parser...
// Analizza JSON e crea la tabella
json = JSON:Parse(risultato);
tempDT = JSON:Crea tabella(json);
Forse esiste un modo migliore per raggiungere i risultati finali oppure dobbiamo rendere disponibile il componente aggiuntivo JSON Parser nell'ambiente JMP-Live?
Distinti saluti,
Giovanni
Names Default To Here(1);
// Create empty Combined Results table
finalTable = New Table("Combined Results");
// Loop through month offsets
For(month = 1, month <= 24, month++,
Try(
// Build and send request
request_url = "https://XXXX-XXX.XXXXXXX.net/XXXX/api/xX.X.X./XXX/dept/dt/month_offset/" || Char(month) || "/met_test_results" ;
result = New HTTP Request(URL(request_url), Method("GET")) << Send;
// Parse JSON and build table
json = JSON:Parse(result);
tempDT = JSON:Make Table(json);
// Append only if rows exist
If(NRow(tempDT) > 0,
// Add MonthOffset column
tempDT << New Column("MonthOffset", Numeric, Set Each Value(month));
// Append to final table
finalTable << Concatenate(tempDT, Append to First Table);
Write("Month " || Char(month) || ": Data added to Combined Results.\n");
,
Write("Month " || Char(month) || ": No data returned — skipping.\n");
);
// Always close the temp table
Close(tempDT, NoSave);
,
Write("Skipping month offset " || Char(month) || " due to error or bad response.\n");
);
Wait (0.25) ;
);
// Show final table if it has any rows
If(NRow(finalTable) > 0,
finalTable << Set Name("Combined Results");
finalTable << Show Window,
New Window("No Data", Text Box("No valid data returned from selected months."))
);
// Assuming finalTable is already your active data table
dt = finalTable;Automazione e scriptingCondivisione e comunicazione dei risultatiR: Il componente aggiuntivo JSON Parser deve essere disponibile nell'ambiente JMP-Live per funzionare sui report pubblicati?Hai mai dato un'occhiata a JSON to Data Table()?
result = "\[[
{
"name" : "KATIE",
"age" : 12,
"sex" : "F",
"height" : 59,
"weight" : 95
},
{
"name" : "LOUISE",
"age" : 12,
"sex" : "F",
"height" : 61,
"weight" : 123
},
{
"name" : "LAWRENCE",
"age" : 17,
"sex" : "M",
"height" : 70,
"weight" : 172
}
]]\";
dt = JSON to Data Table( result );

R: Il componente aggiuntivo JSON Parser deve essere disponibile nell'ambiente JMP-Live per funzionare sui report pubblicati?Questo suggerimento ha funzionato alla grande nell'app desktop JMP, grazie per l'assistenza.
Tuttavia, non è riuscito ad aggiornare con lo stesso script dell'app desktop nell'ambiente JMP-Live. Purtroppo c'è ancora molto lavoro da fare!