Apply Polling rate on named query called upon from radio button selected value

I have multiple Name queries and I want to run them as value selected from Radio button. I could achieve this by property binding to that radio button, but the named query is not updating every 30 seconds, I am not able to apply polling rate here. I tried various approaches
like 1.) runScript(system.db.runNamedQuery()),
2.) import time
while True:
runNamedQuery('')
time.sleep(30)

but both are not working

My Expected outcome should be:

if radioButtonValue == x:
runNamedQuery("Query1")
elif radioButonValue == y:
runNamedQuery("Query2")
else
runNamedQuery("Query3")

Where return should be apply every 30 seconds.

Please help me how can I achieve this?

Hiya,

This probably isnt the most efficient approach, but if the query is to select data (which I assume it is seeing as your polling), then you could create three different custom props on the root object, each with the named query binding set to poll at 30 seconds (hence not efficient as its polling all three), and then based on the radio button state, show the data from either prop 1, 2 or 3.

Alex

Thanks Alex for feedback. But Unfortunately I cannot apply/bind directly 3 unique named query to root object, As I have created one flex repeater panel, based on radio root object selector, all I want to update it in all instances of flex repeater object. So ultimately I have total no of named query are:
3 * no of flex repeater instances

I hope you get me.

Can we somehow do coding on Radio button that every 30 secs, the selected value rebind or else?

I'll admit I dont fully understand, but I think what you need to use is a gateway script, as with these you can do timed execution.

You could perhaps use the gateway timed script to send a message to a 'radioButtonUpdate' message handler every 30 seconds.
Then the radio button component could listen for that message and perform its update when it recieves it?

1 Like

Create a custom property to hold your query result.

Create an expression binding of:

now(30000)

Add a script transform to look at the value of the radio group's index.

if radioButton.index == 0:
    return system.db.runNamedQuery('Query1')
elif radioButton.index == 1:
    return system.db.runNamedQuery('Query2')
else:
    return system.db.runNamedQuery('Query3')

Are you expecting the data to change? If not there really isn't a reason for it to be polling.

3 Likes

Thanks @lrose This suggestion worked for me. Thanks again!