Hi, I would report a strange behaviour of winccoa clients. In some panels I have scripts that load information from a json file (fileToString and jsonDecode functions used), in ULC clients it's all ok, json is parsed correctly and everything run smoothly.
When I use Desktop UI client, it doesn't work at all, from different PC, also on the same winccoa server, no debug information. In log view I can see it downloads succesfully the json file from the scripts dir.
After many tries, I've been able to get a message from the fileToString function, used on a very simple json file "{"TEST":"TEST"}, and it's something like "WINCCOA_CRYPTED_SCRIPT 2 |������{��M�T���N1��(^N�GX�]
Do I have to enable some config in [ui] section ? Desktop UI is able tu run all the default libs functions ? Is it only a problem of encoding (changing "UTF8" o "ISO88591" return different symbols .....) ?
Thanks
Decoding json in Desktop UI
Search
Re: Decoding json in Desktop UI
"WINCCOA_CRYPTED_SCRIPT 2" indicates that the file got encrypted.
Dont put your JSON files below the "panels" and "scripts" folder.
autoEncryption (which is on per default) encryptes all files below the "panels" and "scripts" folder.
https://www.winccoa.com/documentation/W ... Encryption
Dont put your JSON files below the "panels" and "scripts" folder.
autoEncryption (which is on per default) encryptes all files below the "panels" and "scripts" folder.
https://www.winccoa.com/documentation/W ... Encryption
Re: Decoding json in Desktop UI
Thanks for the reply, really useful. Something odd happens in Desktop UI, cause it downloads json files from the scripts/libs folder by default (and they are encrypted), now I'm trying to figure out how to tell it the correct folder /data/mappings/filejson.json
Re: Decoding json in Desktop UI
[SOLVED]
So thanks to killian, I've moved my json files to the /data folder (so they are not encrypted).
Inside my scripts I've changed the path to something like
Then I've set in the config file, [ui] section, so the Desktop UI client downloads those resources at the beginning of the communication with server
So thanks to killian, I've moved my json files to the /data folder (so they are not encrypted).
Inside my scripts I've changed the path to something like
Code: Select all
string path = getPath(DATA_REL_PATH); fileToString(path + "mappings/example.json", jsonData);
Code: Select all
autoUpdataDir = "data/mappings"
Re: Decoding json in Desktop UI
We suggest not use the autoUpdateDir config entry if the data/mappings directory possibly contains a lot of files/data.
It will delay every startup of the UI.
With the function getPath() you can load files from the server to the client during runtime.
Best Regards
Leopold Knipp
Senior Support Specialist
It will delay every startup of the UI.
With the function getPath() you can load files from the server to the client during runtime.
Best Regards
Leopold Knipp
Senior Support Specialist
Re: Decoding json in Desktop UI
Thanks Leo, I saw in the logs that the startup time on the client is only a couple of seconds slower than before. Also, using only getPath without autoUpdateDir doesn’t seem to be sufficient to load files during runtime
-
- Posts: 373
- Joined: Tue Jan 15, 2019 3:12 pm
Re: Decoding json in Desktop UI
Try this:
The function 'getPath' only downloads a specific file to the client (not whole directories).
Code: Select all
string path = getPath(DATA_REL_PATH, "mappings/example.json"); fileToString(path, jsonData);