I am using a slider value to drive a query - all is functioning accordingly but on first startup the slider indicator is showing an inaccurate value.
See below, the slider is set in the Designer at value = 8, min/max and ticks as displayed:
The slider bubble shows 10, however the eight bars pulled from the query are as expected. The total value (bottom right) also reflects the expected output with value = 8. After adjustment and settling back to value 8 I get the expected, as you can see the query results have not changed:
Is this a known issue or anything I’m doing wrong here? I did script to reset the value on window open which eliminated this issue, however I’m using a tabbed arrangement and do not want to reset every time the user switches between main windows, only on client startup.
I assume this is a Vision client? It seems to me that your query is not running when the window is being opened. How is the query used on your graph? If you have the data for the bar chart bound to a named query with the slider value as a parameter, the query should always update on slider change and when the window opens. Explain your script/bindings a bit more.
This is in a Vision client - the bar graph is bound to a named query with input parameter of ‘Slider’.value. The query is set to poll on an absolute 30s. The number label (bottom right) is also tied to a named query with same input parameter and poll rate.
Both queries do execute properly upon window open and produce the expected data for ‘Slider’.value = 8. This is the value that I have set in the Designer and saved, I assume this would correspond to the initial value. The slider, however, displays a 10 as in the first image. Upon no user input for greater than the polling rate the data does not change - it displays as though ‘Slider’.value = 8. Adjusting the slider will modify the table, settling back on ‘Slider’.value = 8 will display the same data as upon startup.
The only issue is the display of the slider - the bubble on first startup shows as ‘10’.
With regard to the query itself - I pull in the value of the slider to set the count of a while loop. Within each loop I total the number of events based on timestamp within a given hour. This is recorded as (Hour (rounded down), Sum()) in a table - ‘Slider’.value = 8 should create 8 data points, etc.
I’m not sure what is going on here. I think you said that you are saving the project with the slider value set to 8, so it should open up as 8 not 10. What version are you on? If you are on < v8.x do you have publish separated from save? Did you publish your save? Are there any other bindings or scripts that are overriding the initial value?
Unless you need the data to update without changing the slider value, I would set the poll rate to
off. Also, I very rarely use
while loops, this should be a
for loop instead.
value = 8
for i in range(value):
value = 8
for i in range(1,value+1):
There are no bindings set for this slider value, every fresh initialization of a designer or client starts this slider at value = 10.
I understand the polling rate is unnecessarily fast or could be eliminated all together in this application, I have only left the query on to update results while in debug and see things moving.
It is my understanding that there is no for loop in SQL, can this syntax be used in the named query?