I’ve been working on process modeling, but it’s not going as well as I expected. I’m having trouble finding instructions or examples on how to use IF or CASE statements to control the process for each part type or visit (whether passed or processed). Where can I find good examples, videos, or instructions?
Thank you in advance
hi
Would you like to query the product type or the flow group?
You can find it in help file " Process Statement Expressions":
as an example:
ProductIn.ProductType.Name as condition in if statement
Hi,
Thank you for your information. I already checked the help, I’m looking for a practical model that shows in how it works.
Hello!
I find most useful to look at the models that Visual Components have as a templates/examples in their Layout section of their catalog. (See images attached)
There, you can see on some of them the actual expression on SWTICH/CASE and IF statements and how they are used in their Process Nodes.
LAYOUTS
TEMPLATES
.
.
MY EXAMPLE
For me, this is the most complicated thing I have used SWTICH CASE statements for.
I use the CASE statement to simulate a probability distribution according with some previously defined parameters. In this simulation a truck arrives with X number of pallets and those are distributed in a warehouse with 9 areas according with a probability distribution.
*: This Process Node is in charge of transporting in the “Trucks” component and create the “Pallet” Component for the resources to transport out.
1: A Truck enters the Process Node and pallets are created in a WHILE loop evaluating for the total number of pallets in the truck [PL<Truck.Component.PL]
2: These pallets will then be transported out to 9 different rooms/locations. A distribution “P” is defined as [P = uniform(0,0,i)]
3: Pallet is created and variables are assigned to it (Name, number of boxes and Truck number)
4: a Switch case is used to see where the Pallet will be transported out to. Each case value is an Aggregated probability for each of the 9 rooms. [Switch(P)], Case <F12, Case <F13, etc.
i.e., if each room has a probability of one unit, the aggregate value to place in the SWITCH CASE statement will be a sum of the previous rooms. F12 = 1, F13 = 2, F14 =3, F22=4 … so on until the last room will be F33=9
If the probability uniform(0,0,i), i=10, each room will have a probability of one.
5: Room information is stored in the “Pallet” component property and is transported out of the Process node. [Pallet.Component.Room = “Out(3-3)”]
I hope this helps using WHILE, SWITCH, IF statements.
Hello,
Thank you for the detailed information. I reviewed it yesterday and learned a lot. However, the only thing I couldn’t figure out was how to read (recognize) the ProductIn after TransferIn and then use IF or CASE to lead the process to specific statements for different ProductIn types.
You can access product’s Product Type and its name using expressions.
e.g. productIn.ProductType.Name as the switch variable, and then “MyProduct” , “MyProduct2” etc. in the case conditions.
Is the below condition is correct:
productIn.ProductType.Name==“MyProduct”
No, you need to put the variable to compare all the cases against in the “Condition” expression in the Switch statement, and then the different values into the “CaseCondition” expressions.
This is basic programming stuff.
So productIn.ProductType.Name into Condition and e.g. “MyProduct” into a CaseCondition. Of course your TransportIn needs to be configured to output into that a variable named “productin” etc. for this to work.