Sign In Register

How can we help you today?

Start a new topic

allow pre-population of gs-query fields

I have a gs-query setup on my dynamic forms, and the queries it spits out are great. The problem I run into is that I have setup a way for my users to save the query they made. I can re-run that query, but I cannot seem to find a way to allow my users to edit or recall their query back into the gs-query gshtml element. I'd love to be able to do something like    

<gs-query name="gsMyName" value="{\"$and\":[{\"location.country\":{\"$ne\":\""Afganistan\"}},{\"lastSeen\":{\"$date\": \"2015-01-13\"}}]}">
    <gs-query-field id="location.country" 
                    label="Country" 
                    type="country"/>
    
    <gs-query-field id='lastSeen' 
                    label='Last Seen' 
                    type='date'
                    operators="equal"/>
</gs-query>

and get the query prepopulated with the values. This would allow me to reuse my queries and not have to completely duplicate the gs-query system.


Hello Arnold V,


I understand it's been a while since this feature has been requested, but you will now be able to to Pre-Populate the query data.

Pre-Populate:


JavaScript:

Spark.setScriptData("rawRules" : "{\"condition\":\"AND\",\"rules\":[{\"id\":\"displayName\",\"field\":\"displayName\",\"type\":\"string\",\"input\":\"text\",\"operator\":\"equal\",\"value\":\"test\"}]}");

GSML:

<gs-query name="gsUserQuery" rules="{{rawRules}}">

Retrieve from Form Submit:


JavaScript:

var jsonRules = Spark.getData().scriptData["gsUserQuery-raw"];
var rawRules = JSON.stringify(jsonRules);

Regards,


Mantas

Hi Arnorld,


Thanks for submitting a feature request, It has been passed on to the Dev Team for evaluation.


Liam 



Login to post a comment