I’ve a table with many rows. In each row is a number in a column.
I sorted the column.
now the number is 20000, 20000, 20001, 20001 … 7000001, 7000001.
I want to check a list of numbers, if the list has gaps i want to extract the row after the gap.
i mean the following is a good code.
if row > 1 AND row.value = row(-1).value or row.value = row-(-1).value + 1
Anybody knows, how i can write this in rule-based row filter ? Do someone have a better idea ?
You can code that in a java snippet or more simply use the LAG Column node.
I’m not java coder dont know how i can adress a row before
Then use the lag node
Here is an example to put the previous values in from of the cell of interest :
example.knwf (25.3 KB)
the second move does the reverse just in case putting the flowing value
i understand the solution. But the Problem is, that the solutions are not correct.
One Solution should be
(because the numbers has gaps before)
and another solution should be
(because this numbers are the gaps)
its possible that a number is not doubled and its possible that gaps are bigger
Well sorry, I really don’t see the point. If I complete the workflow adding the rule to the lag. It gives me that : example3.knwf (22.4 KB)
What should be the result for those datas according to you ?
please find attached a workflow that also calculates all the numbers in the gaps. Unfortunately it does use a Java Snippet node, but I think you will find the code pretty easy to understand, even as a non-Java-coder. Feel free to ask if you have any questions about it.
gaps.knwf (15.5 KB)
thk you both for your solutions.
its very nice; the solutions can help by my workflow.
1 question. Is there no easier solutions as Lag Column ?
Is it not possible to adress a row before the current row in math formula, rule engine, rule-based row filter, and so on ?
generally this is unfortunately not possible. Only some scripting nodes, such as the Python Snippet and R Snippet nodes can access the whole table at once, but that only works well if the data is not too large.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.