Rule engine: column name from flow variable

Hi everybody,

Using the rule-based row filter, is it possible to check for a missing value in a column for which I get the name from a flow variable?

Usually, the syntax to check for missing values in column "col" would be:

MISSING $col$ => TRUE

The syntax to use a String flow variable "var" in the rule engine is

$${Svar}$$

Therefore, if "var" contains the name of the column I want to check, I would do something like

MISSING $${Svar}$$ => TRUE

However, this gives the error message: "MISSING operator requires a column".

Thanks for any advice, Andreas

No, you have to create the rule as a flow variable (for example with the Java Snippet Variable, like return "MISSING $" + columnName + "$ => TRUE";) and replace the rule in the Rule-based Row Filter using that string. This is a bit error-prone to do (especially the flow variable creation and selecting the proper element in the array), but I have no better option, as the node do not allow embedded evaluation, which would be something like $$${Svar}$$$ to select a column. I guess this would be possible to implement, but wold be really hard to understand.

Thank you, I managed to get it done this way!

Hi, I agree with choc.2000 that it would be very useful if the Rule-based Row Filter node would support direct use of flow variables. I would like to use this within a Column List loop to filter out all rows with missing values, column by column.

Thanks/Evert

Hi there @evert.homan,

agree with you but seems to me you can also use Row Filter for your use case.

Br,
Ivan

1 Like

Row Filter (Labs) can maybe do it. The regular Row Filter can only filter based on one column at a time as far as I know.

Cheers/Evert

Hi @evert.homan,

but my impression was you are running a column list loop and filtering missing values. That is way I suggested Row Filter where you can control column name with current column name flow variable.

Br,
Ivan

You are very right of course. Still, use of flow variable directly in the Rule-based Row Filter node would be very useful.

Thx/Evert

Hi @evert.homan,

agree :slight_smile:

Br,
Ivan

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