Jump to content

Search a row from a table using an expression


Recommended Posts

Hello,


How to search for a particular row in a table using an expression?


I am using a time path and want to select the time in that path from a table depending upon the type of entity. There is an option to write an expression in the 'Time' field in time path, but I don't now how to search table using an expression.


Thanks

Link to comment
Share on other sites

There are a couple SimBits that you can review which use the Search step for finding information within a table - SearchTables.spfx and SearchTableUponEnteringObject.spfx. If you still have trouble after looking at those, please provide more information and perhaps attach a model to this discussion or email support@simio.com.

Link to comment
Share on other sites

The general idea is that you will need a process (maybe at the beginning node?) that uses the search step, and then stores the resulting expression in a state on the entity (such as MyTravelTime). Then, you can refer to that entity state in the travel time property of the time path.

travel time --> ModelEntity.MyTravelTime


Alternatively, you can refer to the row directly, if (for example), you have an integer state/property that indicates the entity type, and that corresponds to a row in the table:

travel time -> Table1[EntityType].TimeExpression (Here EntityType is a state or property that you've set somewhere else, and corresponds to the index of a row in the table).


Lastly, you can use the "set row" step in a process to link a row to an entity (or use the built-in Table row referencing properties on the source object). Then, you'd just need to reference the table column in the time expression:

travel time -> Table1.TimeExpression


-Adam

Link to comment
Share on other sites

×
×
  • Create New...