Autonaming for Pipe with condition on Ispec

 
  • Hello,
    i am fighting with the expressions in autonaming.
    I need to add at the end of the name, the insulation spec as follow:
    25-P-1001-ABC-10000-W
    where /W is the Ispec. So comes the " - " + namn of Ispec

    And when we have no Ispec on the pipe, simply:
    25-P-1001-ABC-10000

    Here the expression that works without the Ispec condition:
    !!ce.bore.real().value() & '-' & !!ce.fluref.namn & '-' & (namn of owner of owner) & !!ce.pspe.namn & '-' !!ce.Number

    I want to add something like:

    Ift(namn of Ispec EQ 'Unset' , ' ' , ('-' + namn of Ispec )

    But it doesn't works....How can i test if Ispec is set or unset? Any suggestion?

    Strange is that as Text for labellin it works....as Naming expression not....
  • Try this expression:
    ift(unset(ispe),'', '-' + namn of ispe)

    [COLOR=#333333]!!ce.bore.real().value() & '-' & !!ce.fluref.namn & '-' & (namn of owner of owner) & !!ce.pspe.namn & '-' !!ce.Number & [/COLOR]ift(unset(ispe),'', '-' + namn of ispe)
  • Hi , thanks for help.
    Unfortunately it doesn't work:
    If i have a spec, it works fine.
    If i don't have any spec, it seems the formula take care of  + namn of ispe and as there is no name, i receive an error and the rule is not accepted.

    I wrote 2 rules then:
    One with Pipe without Insulation, giving criteria to the selection: unset(ISPEC)
    -> !!CE.Bore.real().value().string() & '-' & !!CE.Fluref.namn & '-' & !!CE.Scsysf[1].namn & '-' & !!CE.pspe.namn & '-' & !!CE.Number
    --> 25-P-1001-ABC-10000

    One with Pipe with insulation, giving criteria to the selection : unset(ISPEC) EQ FALSE
    ->!!CE.Bore.real().value().string() & '-' & !!CE.Fluref.namn & '-' & !!CE.Scsysf[1].namn & '-' & !!CE.pspe.namn & '-' & !!CE.Number & '-' & !!CE.ispe.namn
    -->25-P-1001-ABC-10000-W

    That works......

    Still strange, if i use the complete formula for labelling, it works fine...

    Anyway thanks. and i hope this can help other.