I’m trying to use the “Rule Engine” that looks at the integer value of 1 field and the string value of another field and update the field accordingly. However, this is not working. Any thoughts? Here is a screenshot of my dialog box:
You say, this is not working. What do you mean by not working?.
Does the Rule Engine throws an error? Is the outcome not as you expected?
How does your input data looks like and what do you expect as an outcome.
Thanks for looking into this… The issue is the outcome is not as expected.
The “Instate” column is a Sting type with only the 2 values of 0 & 1. “Distance” is a Double type with 726 missing values and a min of .791 and a max of 3,882.192. I have previously set all the “missing values” to -1 in Distance (I couldn’t figure out how to use null fields)
What I’m trying to do is to set the missing values (-1) in distance to 0 if the Instate is = 0 and set the missing values (-1) in distance to 2000 if the Instate is = 1.
My logic:
($distance$ = -1 AND $Instate$ = “0”) => 0
($distance$ = -1 AND $Instate$ = “1”) => 2000
$distance$ > -1 => $distance$
The current results is that they change from the -1 to no value.
I think it has something to do with your distance column. In the Rule Engine you treat it like an integer, but it is of type double.
Also when you inpute the missing values with a fix value it create -1.0 instead of 1.
@HansS …
I appreciate your thought. the -1 or -1.0 doesn’t seem to matter.
I’ve used the $distance$ > -1 => $distance$ and that works fine as is or if I update it to numbers. The logic of the ANDs seem to be doing something behind the scenes because those values are cleared out. I’m not sure why that is.
Hi @johnvm , what is the current value of “distance” in the rows that are being affected.
Your rules currently have no “catch all” at the end to determine what happens if distance is currently less than -1, or Instate is not 0 or 1. So in any circumstances where none of the rules match, distance will become “missing”.
If you wish to leave distance unchanged under all other circumstances, add an additional line at the bottom of the rules: