Skip to main content
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,

Best answer by stefanh

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

This works

image.png

View original
Did this help you find an answer to your question?

13 replies

tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • December 13, 2022

Without Test-condition:

Transformer StringFormatter, Format String: 02s


  • Author
  • December 13, 2022

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

 


stefanh
Contributor
Forum|alt.badge.img+8
  • Contributor
  • December 13, 2022

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


  • Author
  • December 13, 2022

Capture


  • Author
  • December 13, 2022
stefanh wrote:

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 ?

 

 


stefanh
Contributor
Forum|alt.badge.img+8
  • Contributor
  • December 13, 2022

This looks good. Is it working?

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


tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • December 13, 2022

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?


  • Author
  • December 13, 2022

Not this position.

The 2 means 2 characters


tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • December 13, 2022

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

Value: 0@Value(test)

else do nothing.


  • Author
  • December 13, 2022
tomfriedl wrote:

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

Value: 0@Value(test)

else do nothing.

non change


tomfriedl
Contributor
Forum|alt.badge.img+13
  • Contributor
  • December 13, 2022

This works:

StringLengthMaybe you can share your workbench/data?


stefanh
Contributor
Forum|alt.badge.img+8
  • Contributor
  • Best Answer
  • December 13, 2022

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

This works

image.png


  • Author
  • December 13, 2022
stefanh wrote:

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

This works

image.png

thank you i understand

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings