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 环境中,它无法使用与桌面应用程序相同的脚本进行刷新。遗憾的是,还有更多工作要做!