How to use Product Type as an If statement condition?

Hello.

In my modeling, there are two kinds of Product Type, for example A and B.

I want to make the condition as;
If the product type is A, some specific operation is implementing.
And If the product type is B, the part pass the process.

Please help me.

Thanks in advance.

You need to use either a string variable or string literal

if(CurrentProduct == "My product type's name")

In theory you could also use a variable of type Ref<ProductType> but you can’t create those from UI and the values would get reset on each process run anyway.

Also generally in PM you don’t need to implement such passthrough logic manually in each process. If the transport system is used the products can go through any transport node without entering any process associated to the node, and you can control what types of products you want to transport in to each process anyway.

Hey,

I made a quick example

You can check the uploaded vcmx.
assign.vcmx (260.3 KB)

Hello, Tsy and Lefa.

It is a great help for me.
But I found another issue.

After setting up the assign, it works.
But after reset the simulation, prod_name is not activating.
Can you teach me what I have to do?


image
image

Thank you.

Dear all,

I found the Solution.
Without defining prod_name string variable, I used ProductIn directly in the if statement.
Thank you everyone.

image

It might work, but comparing equality of variable Ref<Product> and a string literal is just weird. There must be some kind of automatic cast, but its not at all clear why such comparison would compare the product’s type’s name to the string and not something else.

I would use ProductIn.ProductType.Name == "P1" for clarity.