Jump to content

source creating different entities in certain order


ChrisLoe

Recommended Posts

Hi,

I´m looking for a solution, that a source can create different entities (Part A, B and C) in a certain order (and then repeat it, not based on random). For Example: 1st Arrival Part A, 2nd Arrival Part B, 3rd Arrival Part C, 4th Arrival Part A (and so on).


Is there an opportunity to realise this?

I tried to use a data table, but probably I missed a necessary step.


Thank you for helping.

Chris

Link to comment
Share on other sites

First, in a table, list the part types, in order, that you would like, i.e., PartA, PartB, PartC, then PartD in a column.


In the Definitions window, add a new integer state (named 'Index' for example) with default value of 1. This can be used to loop through the table rows (and reset to 1 once you create the last one).


Then, within the Source, use the TableName.ColumnName' as the Entity Type. Within the Table Row Referencing / Before Creating Entities, set the Table Name and then use the 'Index' integer state as the Row Number.


In the state assignments before exiting, simply increase the integer state value - you can use simply a Math.If(Index == 4, 1, Index+1) - or you can use the max rows in the table if you aren't sure how many items in table.

Link to comment
Share on other sites

yeah , it is not so good to increment that Before Exit State Assignment, becuase each entity you created would trigger that.

If you increment that by Math.If(Index == PartDefinition.AvailableRowCount, 1, Index + 1), then the quantitis you defined will trigger many times of calculation.

so say if the first entity is red entity, the quantities are 3, then after the 3rd one coming out of source, the index turns 3.

 

567082152_QQ20171209114904.png.e3f485aa480b6721e684610026cd22a4.png

Link to comment
Share on other sites

×
×
  • Create New...