depends on the size of the table and the flexibility that you need but there are different approaches:
A)
you can iteratively process your table and check top to bottom for the first mismatch between the row number/index against a modulo of your sequence size. this will essentially process the table to top bottom until the first mismatch, correct it and then start the next loop again going top to bottom. use a table splitter and row inserter and table concat when it found a mismatch
B)
if your table size is smaller or you have plenty of processing power, you can also cross-join your sequence against your table and then use e.g. the Column Expression Node with activated Window Access to write a logical check for each row if it is the original one, a row to discard because it was created by the cross join unnecessarily but a record for that sequence element exists already, or lastly a new addition (for which you may then still need to null the other columns except for your sequence
C)
if your sequence is purely numeric, you can also use the Column Expression node with window function, or the moving average / moving aggregation nodes to make a delta to your previous row. whenever your delta n>1 you will need to add n-1 rows of your sequence. and if your delta is negative but not -90 you will need to add a row. issue here is that you should strictly go by set to avoid double entries from double insertions.
Yeah, the Missing Value node is perfect for this.
Just connect it after your data source, choose the column(s) you want to fill, and set the method to “Previous value” (forward fill) or “Next value” (backward fill). You can also combine both if needed.
It works reliably on string and numeric columns. If your missing values are scattered, run it once for forward and once for backward and then use a Rule Engine or Column Combiner to pick the best result.
Super simple and no scripting required. Let me know if your data has any special pattern.
Hi @Karim_Ibrahim
In the sequence: 90,91,92,93 is there always one number missing? Or is it possible that more than one number is missing in the sequence?
This wf seems to work : the idea is to to create a table for specification (ie sequence expected and for each item his successor) then parse the input table for each row and add what is necessary. This can be heavy if your input data are big !
Hope this is usefull !
Best,
Here’s another approach, although it requires some manual adjusting. It reproduces the output you posted, although I doubt that it will work with a large arbitrarily configured input. Insert Missing Values in Sequence.knwf (126.8 KB)