I have 5 columns that are continuous variables. Some of the measures are very small and I want to develop a threshold at which the value would be equal to 0. For example $Column1$<=.1 =>0. I can get this work for each column individually (meaning I have to have 5 rule engine nodes), but I would like to do it in a loop. I am using a Column List Loop Start then the rule engine node. In the Rule Engine Node expression box I have $${DcurrentColumnName}$$<=.1 =>0. However, it shows up as a ? in my results. How do I specific a dynamic column name using the flow variables in the expression box?
Basically, how do I use the column name from Column List Loop Start in the expression box of the Rule Engine node?
Thanks,
Stephen
Update: It looks like part of the challenge is that using the flow variable of the column name in the expression box returns a string without the $ at the front and end, so it doesn't treat it like a column from the column list. Is there anyway to get the currentColumnName wrapped with the $?
Hi Stephen,
use the String Manipulation (Variable) Node to wrap the currentColumnName in "$".
join("$",$${ScurrentColumnName}$$,"$")
You can build the required expression for the Rule Engine Node in the same way by creating your rules dynamically with the String Manipulation (Variable) Node and then feeding these rules into the Rule Engine Node as flow variables.
join("$",$${ScurrentColumnName}$$,"$", "<=.1 =>0")
Hope this helps,
Johannes
Hi Johannes. Thank you for the reply. The first option you propose did not work for me. When I put it into the expression box it is reading the variable like a literal string rather than an actual column variable.
The second option did work. However, I actually needed one more line. I basically want to eliminate low numbers below the threshold and keep the ones above. So the two lines I need are:
join("$",$${ScurrentColumnName}$$,"$", "<=.1 =>0")
join ("TRUE=>","$",$${ScurrentColumnName}$$,"$")
However, when I put two lines into the String Manipulation (Variable) node I get an error. I also tried nesting them separating the lines with a ";" but that didn't work either.
This is so close to what I need. If you have an idea for this please let me know. Again, thanks for the response, super helpful.
Stephen
Hi Stephen,
you're close indeed. ;-)
Simply feed each line/rule into the rule engine node as a separate flow variable. I.e. create a flow variable for each line and pass these flow variables into the rule enigne node and then it should work. Not sure whether it is possible to do this with a single flow variable...
Thanks Johannes, that worked! At first I didn't think it would work because the String Manipulation (Variable) node (which I now have 2) wanted to replace the connection on the Rule Engine node. I connected the first String Manipulation (Variable) node into the second one and then the second one connected to the rule engine. That did the trick. Thanks for your help, I really appreciate it. I have several uses for this and it is going to be a huge time saver. Cheers!
Stephen
Happy to help, Stephen. And BTW the "Merge Variables" node can be helpful in scenarios like yours.