question

asb.p avatar image
1 Like"
asb.p asked Ben Wilson edited

How to access FlexSim variables in query table of calculated table?

Hello All,

I am have created a chart from calculated table. Now i want to have a combo box which displays all the part types in the model. When the user selects the item in the combo box the value is stored in a global variable. But when i try to use this global variable name in query tab of calculated table it is throwing errors.So how to access flexsim variables in query tab of calculated tables.

thanks,

Praneeth.

FlexSim 18.1.0
querycalculated tableglobal variables
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joshua S avatar image Joshua S commented ·

Would you be able to provide your model or a sample of what you are trying to do so we can see the errors it is giving you?

Thanks

0 Likes 0 ·

1 Answer

·
Jordan Johnson avatar image
2 Likes"
Jordan Johnson answered Jordan Johnson commented

In future version of FlexSim, this will be a little more straightforward. For now, you need to find a way to "trick" the parser into realizing that part of the query is FlexScript and not SQL. You can use the as() method to cast the value, which will help the parser out:

SELECT * FROM MyTable WHERE MyCol = myGlobalIntVar.as(int)
SELECT * FROM MyTable WHERE MyStrCol = MyGlobalStrVar.as(string)

testqueryparse.fsm


testqueryparse.fsm (26.9 KiB)
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

asb.p avatar image asb.p commented ·

Hello Jordan,

In the above example if want to use a edit box value on the dashboard instead of global variable.

I want to have a text box on dashboard in which I want to put some number X, As soon as I change the text in the edit box the calculated table should be updated with this new text instead of global variable.

Can you explain how to do that?

Thanks,

Praneeth.

0 Likes 0 ·
Phil BoBo avatar image Phil BoBo ♦♦ asb.p commented ·

Link the dashboard Edit box to the global variable.

0 Likes 0 ·
Jordan Johnson avatar image Jordan Johnson ♦♦ Phil BoBo ♦♦ commented ·

And be sure that the Update Mode on the Calculated Table is something other than Manual.

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.