WebAPI JSON to DataWindow

Systeembeheer SFR
 3 years 8 months ago #329 by Systeembeheer SFR
Systeembeheer SFR replied the code: WebAPI JSON to DataWindow
Hi Govinda Lopes,
Thanks for your help so far. It works great.
Only thing that's not working it to get it working on the appeaon mobile workspace

The tablet can read the scale trough google browser
The server with powerserver kan read the scale trough google browser. (the scale is in our netwerk)

But within the appeon mobile workspace it will not read the scale. IS json code working on the appeon mobile workspace. (same code starting from powerbuilder on a desktop in the same network works fine)

Attachments:

Please Log in or Create an account to join the conversation.

Govinda Lopez @Appeon
 3 years 9 months ago #318 by Govinda Lopez @Appeon
Govinda Lopez @Appeon replied the code: WebAPI JSON to DataWindow
Hi Systeembeheer SFR,

The JsonItemType enumerated values are:

JsonStringItem! -- Type of the JSON node whose key value pair is a string, such as "name":"evan".

JsonNumberItem! -- Type of the JSON node whose key value pair is a number, such as "id":1001.

JsonBooleanItem! -- Type of the JSON node whose key value pair is a boolean, such as "active":true.

JsonNullItem! -- Type of the JSON node whose key value pair is null, such as "remark": null.

JsonObjectItem! -- Type of the JSON node whose key value pair is an object, such as "date_object":{"datetime":7234930293, "date": "2017-09-21", "time": "12:00:00"}.

JsonArrayItem! -- Type of the JSON node whose key value pair is an array, such as "department_array":[999999, {"name":"Website"}, {"name":"PowerBuilder"}, {"name":"IT"}].

You may find more info about it here: docs.appeon.com/pb2019r2/powerscript_reference/ch10s278.html

So you might want to cycle through the JSON looking for your key:value pair "net":500.9 in your example.

I hope this helps.


Regards,

Please Log in or Create an account to join the conversation.

Systeembeheer SFR
 3 years 9 months ago #317 by Systeembeheer SFR
Systeembeheer SFR replied the code: WebAPI JSON to DataWindow
hi,
i am struggeling with this code. In the demo it works fine.

If i try my own wepapi call, the data is shown in the responce / json TAB precily and the same if I look trought a browser. So far so good.
I made a new datawindow with a kolom NET

in the of_importdata line 104 there is an if functie, and there it stops. It will not put the data in the datawindow
See attachment yellow line.
is says here :

// Array item is JsonObjectItem!
if inv_jsonParser.GetItemType(ll_ObjectItem) = JsonObjectItem! then

ll_objectitem = 2
I can;t find why inv_jsonParser.GetItemType(ll_ObjectItem) = JsonObjectItem! What is the code cheking here, and what is the JsonObjectItem!

I only want the NET out of the follwoing json code:

{"grossavg":0,"freefall1":0,"futurenet2":500.9,"tare":0,"target":0,"freefall2":0,"curDigitsTotal":5,"inGrossBand":false,"max":500.9,"count":0,"pcwt":0.45359237,"futurenet1":500.9,"lastsample":1,"curCapacity":500,"adc":8520167,"netmin":500.9,"ntot":0,"roc":0,"units":2,"min":500.9,"ctot":0,"hiresnet":0,"gtot":0,"referenceWeight":0,"curDigitsRight":1,"resultdescr":"LIVE SUCCESS","curDivision":0.1,"ntotcal":0,"inmotion":0,"hiresgross":500.9,"unitsStr":"kg","holdCounts":0,"gtotcal":0,"netavg":0,"net":500.9,"consecNumber":0,"gross":500.9,"netmax":500.9,"futuregross1":500.9,"inmohiresnet":0,"percent":0,"underRange":false,"countavg":0,"futuregross2":500.9,"overRange":true,"resultnr":0,"holdEnabled":false,"inmohiresgross":0,"ntotpluscur":500.9,"ntotminuscur":-500.9,"gtotpluscur":500.9,"ctotminuscur":0,"pcwtx1k":453.59237,"ctotpluscur":0,"gtotminuscur":-500.9,"curUnitsFactor":0.45359237,"motion":false,"datetimestamp":"18/12/2020 15:41:06","scaleId":1,"serialnumber":"191650375","tran":0,"centerZero":false,"adcTimeUSec":2648610,"curDigitsLeft":3,"timeStamp":1608306066}


SOmeone any ideaa how to fix this
Thanks in advanged

Attachments:

Please Log in or Create an account to join the conversation.

Systeembeheer SFR
 3 years 9 months ago #316 by Systeembeheer SFR
Systeembeheer SFR replied the code: WebAPI JSON to DataWindow
Yes it works perfectly.
Preciesly what I need to get data out of a scale.
Thanks

Please Log in or Create an account to join the conversation.