How do I write a rule to replace values for a column (dependent on another value)

I am trying to use Rule Engine Node to write a rule to replace Purchase column from value 0 to 1 when Total Spend column is > 1. But I was unable to do so, can anyone advice.

I have tried this expression but it is not working

$Purchase Count$ = “0” AND $Purchase Indicator$ = “0” AND $Total Spend$ >= “0.01” => “1”
TRUE => “0”

image

Hi @Nimisha1986 , when you say “it is not working”, what is it doing.?

It is much easier for people to assist if you can explain what result you are getting and included the output for the “Purchase” column.

One tip I can also offer when posting code to the forum is to highlight the code and press the “preformatted text” button

that way, the forum software doesn’t make changes to things like the double-quotes, and then we know exactly what code you are using, rather than having to simply assume that you’ve used the correct quotes etc


The main reason for saying all the above is that I don’t see anything wrong with your statement, assuming that it is actually:

$Purchase Count$ = "0" AND $Purchase Indicator$ = "0" AND $Total Spend$ >= "0.01" => "1"
TRUE => "0"

with the possible exception that your Total Spend column in the screenshot is a double and so really should not be compared to a String value

i.e. it ought to be

$Purchase Count$ = "0" AND $Purchase Indicator$ = "0" AND $Total Spend$ >= 0.01 => "1"
TRUE => "0"

Other than that, when I tried it, it worked for me, so please provide further information about what problem you are seeing.

5 Likes

I actually wrote the above rule to change the Purchase Count and Purchase Indicator to “1” when Total spend is above 0.01.

I removed the " from 0.01 value and it worked.

Thanks for spotting my mistake sir!

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.