$$rowcount$$ vs $$rowindex$$

Hi

I’ve discovered something strange, or maybe I’m overlooking it.

I have a table with one column, and I add the $$rowindex$$ (rowindex_math) and the $$rowcount$$ (rowcount_math) to it via the Math formula node. My table then looks like this:

Schermafdruk van 2023-12-19 16-44-12

Next I want to split my table. I do this in 2 ways
$$ROWINDEX$$ = $$ROWCOUNT$$ => TRUE

and that gives me this result, which makes me wonder if this is correct:

Schermafdruk van 2023-12-19 16-46-05

If I create the filter on the rowindex_math and the rowcount_math that are calculated via the Math Formula node ($rowindex_math$ = $rowcount_math$ => TRUE), then there is no record that meets this requirement. Which makes sense.

It seems that Rule Based Row Splitter has a different idea of ROWCOUNT and/or ROWINDEX than the Math Forumla node.
The Rule Engine node seems to be working fine.

rowcount_rowindex.knwf (31.2 KB)

gr. Hans

Hi @HansS , yes there are indeed inconsistencies across nodes with the value of Row Index. Some nodes think it starts at 1 and others think it starts at 0. I think it is recognised that it occurs but for backward compatibility reasons cannot be fixed.

The worst inconsistency for me is in Row Filter, where the node is actually inconsistent with itself :rofl:

:thinking: Ordinarily whatever you see in the config of a node is what you can pass in with a flow variable. But Row Filter doesn’t behave like other nodes in this regard.

Take the following table:
image

If I manually enter the row range 3 to 7 in Row Filter

it returns rows 3 to 7 as expected, using (human) counting starting at 1:

But if I create flow variables with the values 3 and 7, and pass those in:

It treats it as if I’d manually entered 4 to 8, because it “decides” that I must now be using zero-based counting. That is most definitely inconsistent with flow-variable config behaviour elsewhere.

image

I thought I saw a new node (in 5.x) recently that did the same, but the only new nodes that spring to mind that have Row Number entered in this form are
Table Cropper
Cell Splitter
and both of these (certainly in 5.2) treat the flow variable value as if it were the manually entered value (ie what you see on the dialog is what you enter in a flow variable) and so do not behave like the old Row Filter does.

You may be interested in the following posts:

2 Likes

Hi @takbb

Thank you (again) for the clear explanation. Too bad nothing can be done about it. In the future I will be more careful with the row index even when used as a stream variable.
And yet another solution :star_struck:. Good job Brian :smiley: !

Gr. Hans

1 Like

Thank you Hans, and thanks for the “free” solution! :slightly_smiling_face:

2 Likes

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