I have the following setup,
WebClientConnection1.Active := False; WebClientConnection1.URI:='http://192.168.0.13:3000/Viewchannelsstat'; WebClientConnection1.DataNode:=''; WebClientDataSet1.FieldDefs.Clear; WebClientDataSet1.FieldDefs.Add('Count',ftString,10); WebClientDataSet1.FieldDefs.Add('status',ftstring,50); WebClientConnection1.Active := true; WebClientDataSet1.Open;
The server provides this simple response:
[
{
"status" : "Failed channels",
"count" : 0
},
{
"count" : 0,
"status" : "Warned channels"
},
{
"count" : 89,
"status" : "Active channels"
},
{
"count" : 89,
"status" : "Total channels"
}
]
Seeems like WebClient connection cannot handle when datanode is not defined.
WebClientConnection1.DataNode:='';
Please advise how to solve it, as I cannot Modify the server.
Have found the problems relies how to serve JSON,
After changing the server the connection went OK.
In my case this project saved my back:
Thanks for informing a solution was found
I have a simliar question about how to structure the WebClientConnection DataNode property with the following nested JSON to be able to fetch the field names: Is it dot notation such as FDBS.Manager.TableList etc?
{
"FDBS": {
"Version": 15,
"Manager": {
"TableList": [
{
"class": "Table",
"Name": "MainFDQuery",
"SourceName": "item_info",
"SourceID": 1,
"RowList": [
{
"RowID": 0,
"Original": {
"SEQ_NUM": 1126608,
"ITEM_ID": "123456",
"ITEM_TYPE": "",
"DESCRIPTION": "",
"NET_LENGTH": 6,
"NET_WIDTH": 22.8,
"NET_HEIGHT": 4.3,
"NET_WEIGHT": 47.97,
"NET_VOLUME": 588.24,
"NET_DIM_WGT": 3.5436,
"DIM_UNIT": "in",
"WGT_UNIT": "lb",
"VOL_UNIT": "in",
"FACTOR": 166,
"SITE_ID": "",
"TIME_STAMP": "20220527T162409",
"OPT_INFO_1": "",
"OPT_INFO_2": "",
"OPT_INFO_3": "",
"OPT_INFO_4": "",
"OPT_INFO_5": "",
"OPT_INFO_6": "",
"OPT_INFO_7": "",
"OPT_INFO_8": 0,
"IMAGE_FILE_NAME": "",
"UPDATED": "N"
}
},
Assuming you want rowlist, it would be:
FDBS\Manager\TableList