we can use setlabel on exit trigger but my problem is not about changing labels of all the flowitems exiting.suppose there are two items having label say "A" with values 1 and 2 and i want to change the value of item having "A" value=1 to 3.plz help
we can use setlabel on exit trigger but my problem is not about changing labels of all the flowitems exiting.suppose there are two items having label say "A" with values 1 and 2 and i want to change the value of item having "A" value=1 to 3.plz help
If you use the standard "Set Label" trigger option, and click the little 'Code' button to its right, the code-behind for that option will open and show you a line such as
involved.labels.assert(labelname).value = value;
which does the actual setting of the label.
You can change this to something like
if(involved.labels.assert(labelname).value == 1) { involved.labels.assert(labelname).value == value; }
where the additional if clause will check if the current value is equal to 1 or not.
Or you can replace the whole code by something simpeler
Object item = param(1); Object current = ownerobject(c); int port = param(2); if(item.LabelOnItem? == 1) { item.LabelOnItem = 3; }
but then you will not be able to modify it from the popup anymore.
Hello @Mischa Spelt ,
I tried to use your code to change just one label of one product as asked in the question at the top. So I wrote the code below but nothing happened with my flowitem. The Labelname of my first item stayed at 1 after processing.
I also used your second code : Label name doesn't change.
Have you another solution to suggest ?
Thanks for your response
if(involved.labels.assert(labelname).value == 1) { involved.labels.assert(labelname).value == 3; }
Hi Françios. In the second line, you have a comparison instead of an assignment. Replace the == by an =.
Actually you don't need to assert the label twice: when you get into the if it will definitely exist so you can just write it as
if(involved.labels.assert(labelname).value == 1) { involved.labels[labelname].value = 3; }
6 People are following this question.
FlexSim can help you understand and improve any system or process. Transform your existing data into accurate predictions.
FlexSim is a fully 3D simulation software environment. FlexSim can be used to simulate any process in any industry.
FlexSim®, FlexSim Healthcare™, Problem Solved.®, the FlexSim logo, the FlexSim X-mark, and the FlexSim Healthcare logo with stylized Caduceus mark are trademarks of FlexSim Software Products, Inc. All rights reserved.
Privacy | Do not sell or share my personal information | Cookie preferences | Report noncompliance | Terms of use | Legal | © Autodesk Inc. All rights reserved