question

Tee Hiett avatar image
0 Likes"
Tee Hiett asked Matthew Gillespie commented

where is the table for the Where statement in restaurant model?

sql-flexsim.jpg 21327-restaurantsample-6.fsm

I am studying (and modifying) the FlexSim restaurant sample to learn more about FlexSim. I understand what the Where statement in the Sit activity does but I don't know how to access the source table(s). I would appreciate some direction here. Thanks, Tee

FlexSim 20.0.0
tableswhere query
· 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.

Matthew Gillespie avatar image Matthew Gillespie ♦♦ commented ·

I'm not sure what you're asking. What do you mean by source tables?

0 Likes 0 ·
Braydn T avatar image Braydn T commented ·

@Tee Hiett

TableAndChairs is the group TableAndChairs. If you go to Toolbox > Groups > People > Locations > TableAndChairs You will see all the members of that group that the SQL Statement is drawing from.

0 Likes 0 ·
Tee Hiett avatar image Tee Hiett Braydn T commented ·

I can see the Global Lists Locations contains the values for Priority and occupancy that the Where statement needs. How can I see the entire SQL statement?

0 Likes 0 ·

1 Answer

·
Matthew Gillespie avatar image
0 Likes"
Matthew Gillespie answered Matthew Gillespie commented

The Location field on the Table location resource is showing the entire SQL statement:

WHERE TableAndChairs AND Priority = 0 AND occupancy >= Puller.PartySize ORDER BY occupancy

This model was built last year when the only option for writing a custom query was to write the entire thing yourself in that top field. However, in 20.0 we added two more fields to the resource activities to make it easier to write custom queries. So in 20.0 to get the same effect you would configure the activity like this:

Here's an updated model where I made that change: restaurantsample20.fsm


sql.png (7.2 KiB)
newquery.png (8.4 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.

Tee Hiett avatar image Tee Hiett commented ·

The original sql had priority equal 0. The SQL you created that priority equals 150. The model seems to run perfectly with either value, in fact, with another value. Why was priority included? Is there any way I can see this code?

Thanks,
Tee

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Tee Hiett commented ·

When it says "Priority = 0" that's referring to the Priority label on the tables. That statement is saying to only acquire something that hasn't already been acquired. You need this statement or tables that were already acquired can be acquired again before they're released.

The Priority field in the Resource's properties is the Priority value of requests made when you acquire. That way if there are multiple requests for a table, the one with the highest priority will get the next available table.

What code do you want to see? You shouldn't need to look at any code. If you just fill out the 4 fields on the Resource properties it will plug all the pieces in and write the SQL for you.

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.