JSON Parser Add-In 是否需要在 JMP-Live 環境中可用才能處理已發佈的報告?我們最近創建了 JSL 程式碼來從 REST API 呼叫中收集資料。我目前使用的是 JMP 18.01 版本。
本質上,我們的應用程式開發人員為特定製造部門創建了一個場景。我們以「月」為單位呼叫數據,以減少過多的「繁重工作」。我們涵蓋了從今天開始往前 24 個月的數據。然後,我們將每個月的資料合併到資料表中,然後對完全填入的資料表進行分析。
最終,我們打算將此報告發佈到 JMP-Live,而我們的問題就在於此。我快速發布了到 JMP-Live,其中使用了 REST API 調用,但是它無法運行,我懷疑這是由於我們加載到 JMP 中的 JSON 解析器插件造成的。
根據下面的程式碼,您可以看到 JSON 解析器外掛程式發揮作用的 2 行關鍵程式碼...
// 解析 JSON 並建構表
json = JSON:解析(結果);
tempDT = JSON:製作表(json);
也許有更好的方法來實現我們的最終結果,或者我們需要在 JMP-Live 環境中提供 JSON 解析器插件?
此致,
約翰
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;自動化和腳本分享和交流成果回覆:JMP-Live 環境中是否需要有 JSON Parser 插件才能處理已發布的報告?您看過 JSON 到資料表() 了嗎?
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 );

回覆:JMP-Live 環境中是否需要有 JSON Parser 插件才能處理已發布的報告?該建議在 JMP 桌面應用程式中非常有效,感謝您的幫助。
但是,它無法使用與 JMP-Live 環境中的桌面應用程式相同的腳本進行刷新。不幸的是還有很多工作要做!