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.

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:

  1. SELECT * FROM MyTable WHERE MyCol = myGlobalIntVar.as(int)
  1. 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.