assign label to products

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
christian123456
Posts: 12
Joined: Tuesday 22 September, 2015 - 19:41

assign label to products

Post by christian123456 »

Hi all,
I would like to create with one source products which are labelled. The first one should be labelled with 1, the second with 2, the third with 3, the fourth with 4 and the 5th should start with 1 again and so on, and so on.

Would be great if somebody has an idea?!

Cheers, Christian
User avatar
HarryBunnik
Posts: 362
Joined: Monday 07 February, 2011 - 11:22

Re: assign label to products

Post by HarryBunnik »

Ha Christian,

What I would do is create a label and fill it using the Output(c) (This gives the number of products that have left the Source) and use a modulo:

Code: Select all

Label([?????], i) := Mod(Output(c) - 1, 4) + 1
If you place this code on the OnExit trigger of the source, it will label each outgoing product with a number of 1 to 4 under the label name ????.

The -1 and the +1 is to compensate for the fact that Mod(4,4) returns a 0, which is not what you want).

I hope this helps you further,

Cheers, Harry
Post Reply