Hi @tonyjmeade ,
The Column List loop is useful as shown above, although you do have be careful if you have any additional columns that you don’t want to include in the rules, as they will get appended multiple times into the resultant output unless filtered out on each iteration of the loop and then re-attached afterwards. If your table consists only of the columns that you wish to apply flags to, then the Rule Engine in a loop, as described by @mwiegand and @HansS will do the job perfectly.
Here are some alternative solutions:
Depending on the datatypes of your columns, you could use String Manipulation (Multi-Column) for this.
It will work if your columns are Double or Integer, but unfortunately will fail if they are Long, as String Manipulation (Multi) is bugged when it comes to datatypes other than String, Integer or Double.
But within that restriction, the following code will work (you just need to manually exclude any columns that it cannot handle, and columns that you don’t want to process)
string(
$$CURRENTCOLUMN$$ > 0?true:false
)
There is no facility in that node for excluding columns by data type, so that exclusion has to be either performed manually, or by splitting/filtering the columns outside of the node, and bringing them back together afterwards. You can write code to split columns by type, and re-append. If it matters to you, you may also need to add nodes to re-assemble the columns based on their original order in the table.
Something like this:
As a convenience, I have the following two zero-config components that will do the above job for you. These simple filter out any columns other than the ones that the String Manipulation(Multi) node can handle:
Ideally though, there would be a Multi-Column Rule Engine node that could this with a syntax such as:
$CURRENTCOLUMN$ > 0 => TRUE
TRUE => FALSE
Unfortunately there isn’t.
… although I do have another component…
What that component does behind the scenes is actually similar in many regards to both of the above (@mwiegand and @HansS ) solutions (except that to make it into a generic component and provide additional “rule engine-based” facilities it contains a myriad of nodes and it was necessary to use a Recursive Loop rather than a Column List Loop)
If they are of use, or interest, the above components are available on the hub here:
EDIT: oops… forgot to attach this, lol:
Multiple flag columns.knwf (240.6 KB)