#1 2015-05-22 21:59:00

impulsmedia
Member
Registered: 2015-04-21
Posts: 64

How to use filename.json query results

Hello David,
I want to use a filename.json as a kind of INI file, means I want to set certain default variabels out of the database. Now my questions are:

1.
If I set a query, how can I get the unique result of this query into a local variabel. I.e I want to set a new var with the single [Record.Name] I get out of my query? With Setvar "[NewVar]"  "[Record.Name]" "String" I get an error ... undefined

2.
My database.json has the fields Name and Value. After a query with only 1 result/record I want to use the following Syntax:
Setvar "[[Record.Name]]"  "[Record.Value]" "String" - possible or a similar solution?

3.
Do you think abaout a RANDOM control/function ?

Thanks in advance
Walter

Offline

#2 2015-05-22 23:09:07

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How to use filename.json query results

Hello Walter,

impulsmedia wrote:

Hello David,

I want to use a filename.json as a kind of INI file, means I want to set certain default variabels out of the database. Now my questions are:

1.
If I set a query, how can I get the unique result of this query into a local variabel. I.e I want to set a new var with the single [Record.Name] I get out of my query? With Setvar "[NewVar]"  "[Record.Name]" "String" I get an error ... undefined

This is an interesting question. Currently the only way to parse a JSON file is to use the Report control, which in fact do more because visualice the JSON data in an HTML table. However, currently is not possible to parse a JSON string and retrieve it using App Builder available actions.

Definetively I need to think on this because it's very interesting. Of course if you use pure Javascript (with the StartJS and EndJS actions) probably you can do it, but my intention is to made it easy by using some kind of App Builder action or actions. Currently we can get the content of a file using "SimpleGet" action or the HttpClient control, but these are not thinked specifically for JSON files.

Currently I am a little sick, Walter, but I promise you I take a look at this question asa quickly as possible.

impulsmedia wrote:

2.
My database.json has the fields Name and Value. After a query with only 1 result/record I want to use the following Syntax:
Setvar "[[Record.Name]]"  "[Record.Value]" "String" - possible or a similar solution?

Anidated variables is something not available and probably it's not a thing which we can implement more or less easily, to be honest. However, we have actions like "Loop" or "While" and with the help of these actions and other possible actions to deal with JSON of course we must access individual JSON fields or iterate over records. Not currently, but probably in a near App Builder release.

impulsmedia wrote:

3.
Do you think abaout a RANDOM control/function ?

Do you refer to a Random action which provide us a random number? Yes; of course some random related actions can be useful and probably you can count with something like that in a near release of the program. If I am wrong and you refer to other thing, please, tell me.

Offline

#3 2015-05-23 04:04:43

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How to use filename.json query results

Hello again,

I want to continue with our possible JSON interaction, however, if you update App Builder, you can view two new actions: "LoadVariables" and "ParseVariables". This action can be used to load variables from app or remote files in an easy way. Take a look at the action's help and don't forget to play with the new "LoadVars" and "ParseVars" app samples.

Probably you can achieve what you wanted using one of these actions Walter.

Offline

#4 2015-05-23 11:03:45

impulsmedia
Member
Registered: 2015-04-21
Posts: 64

Re: How to use filename.json query results

Hello David,
thank you very much, you´re the best. Both new actions are perfect and help a lot. And yes RANDOM action is ment as you described it as a random number. Thanks again and take care of your health!

kind regards,
Walter

Offline

#5 2015-05-23 13:57:37

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,661
Website

Re: How to use filename.json query results

Hello Walter,

Thanks very much. Right now I add two new actions into the Math category: "Random" and "RandomEx". The first one provide us with a random number from zero to 1^10 inclusives. The second one provide us with a random number from the specified min and max numbers inclusives.

Offline

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.