question

Chiheb BM avatar image
0 Likes"
Chiheb BM asked Ben Wilson commented

How can i create new labels that depend on the value of the input labels

for example I have two types of labels "A" and "B" and I want on process finish the "A" becomes "AA" and the "B" becomes "BB". how to fix this problem

FlexSim 20.2.3
triggersset labels on process finishset labels that depend on labels value on entry
· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Joerg Vogel avatar image Joerg Vogel commented ·

Do you want to change the name or the value?

0 Likes 0 ·
Ben Wilson avatar image Ben Wilson ♦♦ commented ·

Hi @Chiheb BM, was Jörg Vogel's answer helpful? If so, please click the red "Accept" button on their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Joerg Vogel avatar image
0 Likes"
Joerg Vogel answered Joerg Vogel commented

here I duplicate name character and value of label on process finish. Label is first in labels view.

item.attrs.labels.subnodes[1].name+=item.attrs.labels.subnodes[1].name; //enhance name
item.attrs.labels.subnodes[1].value+=item.attrs.labels.subnodes[1].value;// duplicate value

duplicate_name_label_value.fsm


· 2
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Chiheb BM avatar image Chiheb BM commented ·
my concrete problem is not to duplicate the name but to change it completely (the simplification of my problem is the following:
 if the value ( type string) of the label at the input (coming from the source) is " spring "then 
      on process finish I want to have a value label" hardened spring ". 
and if the label at the input is "bolt" then
      on process finish I want at the output a value label "hardened bolt"
note: I am still a beginner in the use of flexsim therefore I can confuse between the concepts
0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Chiheb BM commented ·

You are looking for a way to manipulate a string as label value. Then you should take a look into the methods and operators to work with the string class. Working with labels is part of another class: labelProperties and labels.

If you look closer into the second suggested code line, I concatenate a string value with the same string again. In fact it uses the “+” operator. It is up to you, how you change a string value of a label. Your example shows an operation, where you add at start of a given string another string

item.myLabel = “hardened “+item.myLabel;

If you are confused, what this is all about, then I recommend you do some more tutorials, because labels are one of the most important structures inside of FlexSim.

0 Likes 0 ·