Skip to main content
Solved

Bulk Mapping Negative attributes to 0


jacklonsdale
Contributor
Forum|alt.badge.img+4

Hi,

I have a set of 24 attributes each with a calculation which results in a numeric value. Is there a way to set a conditional statement across all of these in a similar way to how the NullAttributeMapper works?

I want to apply across all 24 attributes "If value <0, then map to 0" but i want to try and avoid 24 individual conditional statements within an AttributeManager.

Thanks,

Jack

Best answer by redgeographics

This kinda feels like cheating but...

You can use a regex in the NullAttributeMapper:

The second option, "Or If Attribute Value Is:" only seems to accept specific values so this is probably the easiest workaround.

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

4 replies

redgeographics
Celebrity
Forum|alt.badge.img+49
  • Celebrity
  • Best Answer
  • March 30, 2020

This kinda feels like cheating but...

You can use a regex in the NullAttributeMapper:

The second option, "Or If Attribute Value Is:" only seems to accept specific values so this is probably the easiest workaround.


jacklonsdale
Contributor
Forum|alt.badge.img+4
  • Author
  • Contributor
  • March 30, 2020
redgeographics wrote:

This kinda feels like cheating but...

You can use a regex in the NullAttributeMapper:

The second option, "Or If Attribute Value Is:" only seems to accept specific values so this is probably the easiest workaround.

Don't mind a cheat! Thanks, worked perfectly.


takashi
Influencer
  • March 30, 2020

Hi @jacklonsdale, alternatively you can use the ExpressionEvaluator with the Overwrite Existing Attributes mode.

@CurrentAttribute() < 0 ? 0 : @CurrentAttribute()

0684Q00000ArKCSQA3.png


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • March 30, 2020

I would use an ExpressionEvaluator after the AttributeManager in Mode Overwrite Existing Attributes with the expression

@CurrentAttribute() < 0 ? 0 : @CurrentAttribute()

and select your 24 attributes to overwrite.


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