question

Jason Botha avatar image
1 Like"
Jason Botha asked Brian commented

Creating items from a schedule

We are trying to create flowitems according to an arrival schedule. However, the schedule contains many entries and is too big to paste into the source arrival schedule table.

Is it possible to run the same logic used by the source when creating flowitems according to a schedule but instead reference a SQL database and have the arrival time stored in there?

If there is, how would I go about making this work? I have already been able to get a connection to a SQL database from the model if that helps.

FlexSim 16.0.1
sqlflow itemsschedule
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

Ben Wilson avatar image
1 Like"
Ben Wilson answered Brian commented

You want to make as few database or Excel reads during your model run as possible, as this will slow your model run speed. At the same time, your table is too big to import all at once.

Here is one concept you might use to strike a balance between these competing issues:

Use a queue in place of the source. The queue can act like a source by creating flowitems on demand via its OnMessage trigger.

Create a control object in your model with message trigger logic that will query your database. Use a LIMIT clause to specify how many rows to read in, and to offset from the beginning of the database table. Choose some amount of arrivals that will work for you, say 100 rows at a time (you choose the right quantity for you). Create a global table, or a label table on the queue, and at model time 0 send a message to the control object to import the first 100 rows.

Next create a message loop that will start at row 1 and send a delayed message that will fire on the row 1 scheduled time. When the message is received, the flow item(s) are created (a queue can create flowitems based on a message), and a new delayed message is sent that will arrive for the row 2 scheduled time. When you get to the row 100, read a new 100 rows from the database and start all over.

This is all somewhat abstract without an example model. I'll see if I can't cook something up soon and update this answer. Someone else may have a nice way of doing it in Process Flow, so we'll see if any other suggestions come in as well.

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

Brian avatar image Brian commented ·

Would anyone happen to have an example or sample SQL script for this function?
(New user)

0 Likes 0 ·