# double looping

Hello,

I have got this new problem.

I would like to row filter a data table, column by column, according to boundaries specific to each column. Then of course, they all must be joined in function of the first untouched "time" column.

example: I wish to row filter A and B.

table1:      time        A       B

Row0        100       10      50

Row1        110        30      15

...              ...            ..          ..

Row1000  10100     20       5

table2:                       lower_bound      upper_bound

Row0 (bounds for A)            a1                   a2

Row1 (bounds for B)             b1                   b2

Result wanted:      time                   A                                        B

...            a1<values of A<a2              b1<values of B<b2

I actually have a double loop, one iterating on rows(TableRow To Variable Loop) and one on columns (Column List Loop Start). But it rowfilters each column for each interval of bounds, which gives me a matrix, that I don't need, which means I got:

time                   A                                        B                              Iteration

...            a1<values of A<a2              a1<values of B<a2                   0

...             b1<values of A<b2              a1<values of B<a2                   1

Is there a way of not having this useless computations? otherwise, an efficient way of filtering this matrix to get the result table I want above?

Thank you once again, in advance!

Heej.

Hello Heej,

I took a look at this just now and have a possible solution for you.  Please consider it and let me know if I am missing a key point.

My workflow would use a string of nodes to convert your boundary conditions to flow variables and then use these flow variables with row filters to find your events of interest. In shorthand, it looks something like (Boundary Table)->Unpivot->Column Filter->Transpose -> Table row to Variable --- Row Filter (on your input data, using the bounds for Column A) -> Row Filter (using bounds for Column B).

Since a picture is worth a kiloword, see attached.

hello Aaron!

However, I think indeed that you are missing a key point.

My real data won't have only two columns, but unexpectedly many. So the key concept would be a loop on the table with the Bounds, and a loop on the columns, each of them using the corresponding bounds..

But your workflow would clearly work with little data! Nevertheless, the user would have to enter every bound manually here.

The problem gets tougher when it comes to loops, with the rowIDs problems at the end of each loop, since I want the same table as input in the end, with missing values where rows must be filtered.

Tell me if I misunderstood your solution.

Thank you.

I extended the solution to take an arbitrary set of boundary conditions, and used a loop to do each filter step; this time using a java snippet instead of a row filter.  It gets a bit tricky inside the loop as you have to come up with a generic name for your active column so that it is easily referenced with the Java snippet node, but I think it is survivable.  I also preserved all of the rows from the original table, is that what you were looking for?

How did you manage to get that...this is so perfect and simple, especially compared to what I had. Thanks a lot Aaron!