Rule based row filter & variable

Hi,
I want to use a variable in a rule-based row filter and I have an issue with the IN clause.

With the following rule without variable: $Onglet$ IN (“d4-NAM”,“2Cl-Ade”) => TRUE I get what I want.
When I use a variable for the list in () here “d4-NAM”,“2Cl-Ade” my rule looks like $Onglet$ IN ($${SinterStdFilter}$$) => TRUE (where interStdFilter = “d4-NAM”,“2Cl-Ade”) It returns no data.

Am I doing something wrong or is there a restriction in using the IN clause with a variable?

Thanks for your help,
Claire

Hello @Claire,

node identifies flow variable inside IN() function as one value thus looking for “d4-NAM”,“2Cl-Ade” and obviously returning empty data table. You should use one flow variable for each value and add them all separated by comma.

Alternatively you can build entire expressions as flow variable, use that flow variable for rules field under Flow Variables tab and that will work.

Br,
Ivan

3 Likes

Hi Ivan,

Got it - thanks a lot.
Claire

2 Likes

Hi @ipazin
How should I construct an expression with rules which would cover several lines (so several => FALSE and => TRUE lines)?
I tried a join() in a string manipulation using “\n”, and even “\\n”, as line separator, but that gives a warning that there is garbage at the end of the rule.

Hi @ipazin

Found a solution myself! I noticed the small brackets on the icon before rules.
afbeelding

This pointed me into a direction of collections. Maybe it’s not the smartest solution, but the following works in my case (3 rules, so that would be 3 lines in the rule base row splitter when it would be typed).

2 Likes

Hello @JanDuo,

glad to hear that! Actually I think that’s the proper/better approach/solution instead of using String Manipulation node to build multiple rules. And once any of variable nodes will be able to handle (create) collection (array) flow variables one node will be sufficient for this :wink:

Just occurred to me that following trick can reduce number of nodes. In “dummy” Rule-based Row Splitter node write your rules and export rules as flow variable. This will give you collection flow variable to use in “real” Rule-based Row Splitter. (In case you don’t know how to export node’s configuration as flow variable see here.)

Br,
Ivan

1 Like

Congratulations.
Just for my understanding. What exactly do you mean with 3 lines filtering? You have 3 columns you want to test?
Thanks

Hi @Daniel_Weikert

I meant 3 rules I needed for my filtering. So something like:

$A$ = 1 => TRUE
$A$ = 2 AND $B$ IN (0, 8, 14) => FALSE
TRUE => TRUE

The string configuration was for the entry of this “0, 8, 14” (or whatever is needed). The three String manipulation nodes are one for each line. The rest was needed to change these lines into a string collection flow variable, which was to be used by this rule base row splitter at the end (through the parameter rules on the flow variable tab, see reply of Ivan earlier).

1 Like

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