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.

  • December 13, 2022
  • 13 replies
  • 73 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

13 replies

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

Without Test-condition:

Transformer StringFormatter, Format String: 02s


  • Author
  • 6 replies
  • December 13, 2022

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

 


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

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


  • Author
  • 6 replies
  • December 13, 2022

Capture


  • Author
  • 6 replies
  • December 13, 2022

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
  • 38 replies
  • 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
  • 177 replies
  • 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
  • 6 replies
  • December 13, 2022

Not this position.

The 2 means 2 characters


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

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

Value: 0@Value(test)

else do nothing.


  • Author
  • 6 replies
  • December 13, 2022

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

Value: 0@Value(test)

else do nothing.

non change


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

This works:

StringLengthMaybe you can share your workbench/data?


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

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

This works

image.png


  • Author
  • 6 replies
  • December 13, 2022

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

This works

image.png

thank you i understand