Hello David and other friends,
I am at that time where the brain is lost by many hours of trials : I am looking for a way to fill a Report from a String and don't understand why it is not working with the example attached (I swear to have searched the examples provided with AB).
On that example, I have a button at the left which serializes / unserializes the content of an Array that I would like to use to feed the Report1.Data. The console shows that Report1.Data is the String I provide.
With the button at the right, I only feed the Report1.Data from code (example provided in the Help file). In the console, I can see that Report1.Data is composed of two Objects.
But why doesn't it work when I provide the String as data because it does work when you provide a file in the Report1.Url ? It is a string too. I am a large bit lost
Many thanks for any reply :p
Well, perhaps is this because I feed the report with
but I am unable to add the closing bracket "]" (and accessory I have lost the page of the special characters in the help file)... I need some rest :)
No, won't work either...
Oh, I noticed that we seem to have lost :
If you check the Watcher "Add app variables" checkbox then App Builder add to the debugger watcher app variables created by the SetVar, NewArray and NewObject actions.
Removing, adding the Watcher again seems to work btw
Please, take a look at the attached sample, which is a modification of your own one. Take a look in particular at the "Button3" (From string) Click event. As you can see, we can deal with objects directly, that is, we no need to serialize nothing, but, just add any number of objects into the Report's Data variable.
Download the modified sample from here
Please, let me know if you have any further question!
Thanks a lot for your support and the example provided. The problem I still have with that example is this one : I receive the JSON from a server but would like to encrypt it (make a packet that I will decrypt when received). So, I have the String, not the objects in a list (an array) ordered.
It is inside a browser app so I can not use the File plugin (I think) and so I can not reload a clear save file. And I can not imagine (at the moment, probably tired on this), recreating objects reading from the JSON string.
Please, forgive me if I am not clear enough and thanks a lot for your help. I will try again tomorrow on the project. All my bests, David :)
Please, take a look at this sample:
Download the sample from here
The sample uses the CryptoJS library to encrypt some JSON string. We have saved that JSON in an app's local file, but, we can also retrieve it from a remote service. In any case we must decrypt the source (encrypted) string, and then, serialize the string to convert it to an Array of objects, that we can directly set to the Report's Data variable.
But your example is fantastic too.
What I have learned from my researches since yesterday (and I was surprised) is that I have to unserialize (in the example I already provided) and create a new object then add it to the report, while I thought I could only provide the related data as if it was a json file.
But again, many thanks for your fantastic support and patience :)
Always thanks to you sir. I am happy to help when possible! Certainly encrypt and decrypt data in these cases can have some sense, however, maybe a good HTTPS connection between the server and the app can do the job. Anyway, as you can see, we can encrypt, decrypt, serialize, unserialize, without problems, so, if you have any of them, just post it here and we will try to help. :)
Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.