Filter a table by pair and odd rows (sequence pattern)

Hi,

I would like to filter a table following a sequence pattern like:
Row Number Status
1 TRUE
2 FALSE
3 TRUE

One option can be to add a sequence of 0,1,0,1,… in a new column and use a rule engine but looping over row by row to add 0 o 1 is quite time consuming operation
Any smarter way of going it?
Thanks
Paco

Hi @PacoMasip

Can you maybe be a bit more specific about your ruleset that should apply and provide a larger sample set with expected output? In your title you mention by pair and odd rows, yet the mentioned example has 3 rows of which 2 are odd (being non-sequential), so what constitutes a pair?

When should which row be filtered? Should a sequence of one true and one false already trigger the row filter and if so, which records should be filtered? What happens when the sequence keeps continuing in set pattern?

This will drive what a feasible solution could be i.e having to use loops or not. The more you can provide, the better :wink:

Hi,
The table has around 800 rows and in this case I want to filter pair rows from odd rows in other words if one row gets selected next one is not and so on for the full table

Not sure if that helps me but if you are just looking to filter out odd rows, I would use a Column Expression (or Math Formula) and calculate the modulo of 2 for each row number by using mod(column("Number"),2)

This way you can stay away from loops. If you then apply a Row Filter afterwards you can select odd (1) or even (0) rows to your desire.

2 Likes