Solved

Hi, I would like to test the condition if with the @stringlength function. Test condition: If the length of the "section" attribut is equal to 2 then keep the attribute value. If not add ‘0’ before the attribute value. My query doesnt work.


Can you help me to find the solution?

Thanks,

icon

Best answer by stefanh 13 December 2022, 16:00

View original

13 replies

Userlevel 2
Badge +12

Without Test-condition:

Transformer StringFormatter, Format String: 02s

I use the "AttributeManager" transformer with Test-condition.

 

Badge +2

In this case the StringPadder - Transformer might also be the solution.

Capture

In this case the StringPadder - Transformer might also be the solution.

Need to add a new transformer ? Not possible to do with AttributeManager and Test-condition ?

 

 

Badge +2

This looks good. Is it working?

There is also the @PadLeft StringFunction you can use in the AttributeManager.

Userlevel 2
Badge +12

I think FME is confusing the brackets in the attribute identifiers.

your condition is

@StringLength(@Value(Section (R ...))) 2 = @Value( ...

What does the 2 (at this position) stand for?

Not this position.

The 2 means 2 characters

Userlevel 2
Badge +12

Test conditon: @StringLength(@Value(test))=1

Value: 0@Value(test)

else do nothing.

Test conditon: @StringLength(@Value(test))=1

Value: 0@Value(test)

else do nothing.

non change

Userlevel 2
Badge +12

This works:

StringLengthMaybe you can share your workbench/data?

Badge +2

You don't need the @Evaluate part in the Test.

This works

image.png

You don't need the @Evaluate part in the Test.

This works

image.png

thank you i understand

 

Reply