MVP
long ll_return
RestClient lnv_RestClient
lnv_RestClient = Create RestClient
// Set DataObject
dw_1.DataObject = "d_sq_gr_emp"
// Send request using GET
ll_return = lnv_RestClient.Retrieve(dw_1, "https://demo.appeon.com/PB/webapi_client/employee/102")
// Check the return value
if ll_return >= 0 then
MessageBox("Success", "Rows = " + String(ll_return))
else
MessageBox("Error", "Failed to retrieve data.")
end if
我直接把上面例子网址用浏览器打开,有json数据,有一行,怎么我建立对应datawindow,用上面代码,不能在dw中检索收到数据,谢谢请教
你可以参考RESTClient object的SendPostRequest的方法看看是不是你想要的
https://docs.appeon.com/pb2019r3/powerscript_reference/ch02s04s694.html
DW 导出Json可以参考如下方法:ExportJson and ExportRowAsJson
PowerServer Mobile 不支持 RestClient对象。也不支持ImportJson方法。
参考链接如下:
https://docs.appeon.com/ps2020/features_help_for_appeon_mobile/unsupported_objects.html
建议你使用httpclient 来获取相关访问的API link 返回的JSON 字符串,
然后使用appeon_workaorunds.pbl中提供的eon_cjsonnode和eon_cjsonnodearray对象,实现数据窗口export/import json data的功能
这里有个示例demo,参考如下
https://community.appeon.com/index.php/codeexchange/powerserver-web/29-export-data-from-a-datawindow-to-json-and-import-json-data-to-a-datawindow
还是一样,会不会有其它原因,会不会https这种不行,附件是运行后,返回的结果,还是0行,datawindow也用的是你的附件, 代码就 那几行,到底什么问题?
long ll_return
RestClient lnv_RestClient
lnv_RestClient = Create RestClient
// Set DataObject
dw_1.DataObject = "d_sq_gr_emp"
// Send request using GET
ll_return = lnv_RestClient.Retrieve(dw_1, "https://demo.appeon.com/PB/webapi_client/employee/102")
// Check the return value
if ll_return >= 0 then
MessageBox("Success", "Rows = " + String(ll_return))
else
MessageBox("Error", "Failed to retrieve data.")
end if