Skip to main content
Solved

Replace attribute values for all attributes

  • November 3, 2018
  • 3 replies
  • 356 views

venu
Contributor
Forum|alt.badge.img+5
  • Contributor
  • 44 replies

Hi all,

I want to replace not equal to "0" to "1" and if any value missing replace to "0"

 

Original

Attribute1Attribute2Attribute3Attribute4Attribute5Attribute6Attribute7Attribute8231212301235650

 

231230231000031240000370232102312234340000320001220023232123120127700

 

 

 

Expected result

Attribute1Attribute2Attribute3Attribute4Attribute5Attribute6Attribute7Attribute8110110010100001000011010111000010001001110110000

 

Please advise

Best answer by takashi

I would firstly use the NullAttributeMapper to replace every missing, empty, or null attribute with 0, then use the ExpressionEvaluator to assign 1 to every non-0 attribute.

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.

3 replies

danilo_fme
Celebrity
Forum|alt.badge.img+51
  • Celebrity
  • 2077 replies
  • November 3, 2018

Hi @venu

 

I created your case here with only two transformers.

StringReplacer - to find any number more than 0

NullAttributeMapper = to find <missing> values and replace to 0

 

 

Results:

 

 

Attached the Workspace template - FMWT.

 

Workspace_Replace_Values.fmwt

 

Thanks,

Danilo


takashi
Celebrity
  • 7843 replies
  • Best Answer
  • November 3, 2018

I would firstly use the NullAttributeMapper to replace every missing, empty, or null attribute with 0, then use the ExpressionEvaluator to assign 1 to every non-0 attribute.


venu
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • 44 replies
  • November 4, 2018

I would firstly use the NullAttributeMapper to replace every missing, empty, or null attribute with 0, then use the ExpressionEvaluator to assign 1 to every non-0 attribute.

thank you very much