Skip to main content
Solved

Replace attribute values for all attributes

  • November 3, 2018
  • 3 replies
  • 329 views

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

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.

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

3 replies

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • 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
Influencer
  • 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
  • November 4, 2018
takashi wrote:

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


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