FSQL getvariable function

I was wondering while at home this evening I thought up something that might work. But wanted the experts opinion on it. It has to do with the getvariable in FSQL. Here is the code I was thinking of but like I said being at home I dont have the software installed to test.

switch({shift},1, 2, 3, getvariable(lo,0), getvariable(med,1), getvariable(hi,2)) 

Thanks and have a great day.

The item will be set to string and shift is another item in the same group which value will be 1, 2 or 3 and the getvariable will also be a string. I think I cover everything here. Or at least I hope.

I did try this and it seems to work fine. I do however have some questions.

As you may know I have 99 groups, and in each group I had a query that pulled some data from one table and populated it in the historical table. After doing some reading I found this getvariable and thought.

What if I create one group, this group would get the data, much as the query did in each of the groups. It would then store that in a global variable and each group would then poll this global variable instead of using a query. This way it would only be one query not 99 queries. So far I think this make sence.

So with that being said, I wanted to make sure that I under stand the docuimentation correctly. If you have a store variable that has ran, it takes and if there is not a variable with that name it creates. And this variable stays so long as you do not do a delete variable. Is this correct?

So that would mean if I have a group which stores the variable, I run the group, which runs the store variable function, it now creates it if it does not exist, and stores the data. And if I stop the group that data stays there unchanged. Would this be correct as well or does stopping the group clear the variable?

I have not upgraded to 4.2.10 yet but see something that is kind of weird in 4.2.9 and since i have not read the change logs yet I will post it here and if it has been notified and or fixed then fine. The issue is the PLEASE WAIT dialog box, which occurs when loading the groups, sometimes does not go away after loading. Now this is on my programming box which is running the 2hour version not on the server running the registered version. Since I dont have full access to the server I can not say if the same problem occurs there. I have tried to uninstall and reinstall the software, rebooted PC, etc. But so far it keeps doing it and it is very random.

Thanks and have a great day.

Yes, it seems like everything you said about the Store and GetVariable functions is correct. The data will stay in memory even if you stop the group, until you call deletevariables or FactorySQL is restarted.

If all of the groups are pulling in the same piece of data, you’re perfectly right: using one group that pulls it into a variable could be much more efficient.

As for the “Please Wait” dialog, it should be fixed in 4.2.10.