question

Jacob E2 avatar image
0 Likes"
Jacob E2 asked Jacob E2 commented

Use Global Variable in DBC Import Query

Hello, I am trying to find a way to utilize a global variable in the WHERE statement of the import query of my database connector. The intention is to use an Edit Text Box linked to the global variable that will be used to update the query. I want to do this so that the end user can update the query parameters frequently without having to learn FlexSim and SQL.

Example is shown in the picture below. I have tried enclosing the GV in {} as recommended here: Global variable in Query. However, that did not work for me either. Can this be done, or is there a workaround?

dbc-globalvariable.pngdbc-errors.png

FlexSim 23.2.0
sql querydatabase connector
dbc-errors.png (15.5 KiB)
· 2
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·
@Jacob E2, you are aware of, that a global variable is a construct for an emulation tool, which you use to connect to a PLC?
0 Likes 0 ·
Jacob E2 avatar image Jacob E2 Joerg Vogel commented ·

@Joerg Vogel, the use of global variables is not limited to only emulation. There are specific versions of them called Emulation Variables that I have used to connect and read tags from PLCs. Please see: Variables I am not looking to connect to a PLC in this case.

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Jacob E2 commented

For this you should create your own import script and use a preparedStatement to then set your parameters to the global variable value.

· 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.

Jacob E2 avatar image Jacob E2 commented ·
Thank you. I'll give that a try.
0 Likes 0 ·