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.

  • Dec 13, 2022 8:23 AM UTC
  • 13 replies
  • 192 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

View original
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
Supporter
Forum|alt.badge.img+14
  • Supporter
  • Dec 13, 2022 8:31 AM UTC

Without Test-condition:

Transformer StringFormatter, Format String: 02s


  • Author
  • Dec 13, 2022 8:37 AM UTC

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

 


stefanh
Contributor
Forum|alt.badge.img+8
  • Contributor
  • Dec 13, 2022 9:16 AM UTC

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


  • Author
  • Dec 13, 2022 9:31 AM UTC

Capture


  • Author
  • Dec 13, 2022 9:46 AM UTC

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
  • Dec 13, 2022 9:56 AM UTC

This looks good. Is it working?

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


tomfriedl
Supporter
Forum|alt.badge.img+14
  • Supporter
  • Dec 13, 2022 10:22 AM UTC

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
  • Dec 13, 2022 11:07 AM UTC

Not this position.

The 2 means 2 characters


tomfriedl
Supporter
Forum|alt.badge.img+14
  • Supporter
  • Dec 13, 2022 11:21 AM UTC

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

Value: 0@Value(test)

else do nothing.


  • Author
  • Dec 13, 2022 2:14 PM UTC

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

Value: 0@Value(test)

else do nothing.

non change


tomfriedl
Supporter
Forum|alt.badge.img+14
  • Supporter
  • Dec 13, 2022 2:27 PM UTC

This works:

StringLengthMaybe you can share your workbench/data?


stefanh
Contributor
Forum|alt.badge.img+8
  • Contributor
  • Best Answer
  • Dec 13, 2022 3:00 PM UTC

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

This works

image.png


  • Author
  • Dec 13, 2022 3:09 PM UTC

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

This works

image.png

thank you i understand