Icon

Set value on lagged row multi-column-conditions with adjacent rows (b)

Set value on lagged row column conditions with adjacet rows

Demonstration workflow to lag multiple columns to test adjacent rows and then apply rules based on the lagged columns

This pattern will "lag" a set of columns by joining ThisRowNumber to PreviousRowNumber and then ThisRowNumber to NextRowNumber.We tell it to keep ALL columns from the LEFT (upper data port) table and only a subset of columns from the RIGHT (lower data port) table inthe join The java snippet makes uses of a feature that means it remembers stored java variables from onerow to the next. This means that we can determine the outcome for one row based on the storedoutcome from what came from the row immediately prior. This is something the Rule Engine, andmost other nodes cannot do, but it does require a small amount of java, making this now a "low-code" rather than "no-code" solution.For a description of how the java snippet "memory" thing works, see the following post: https://forum.knime.com/t/java-snippets-have-long-memories/33125 Fixed "bug" that previously wasn't spotted as it previously didn't matter.The logic was previously wrong for the joiner nodes, and they way theyworked. This didn't matter for the previous solution, but it would be wrongnow, and would cause confusion. Rule-based RowFilter removedand "common"rules added tostart of both of thetwo new RuleEngines Joiner to join backoriginal data nolonger requiredas Rule BasedRow Filter wasremoved sequentialcounter to providesequentialrow identificationnewsample dataCounter for "Previous row"Counter for "Next row"Renamecounters asThisRowNumberPreviousRowNumberNextRowNumberJoin NextRow and keepspecific columnsrequired for conditionsJoin PreviousRow and keepspecific columnsrequired for conditionsApply conditionspecific remainingrulescompare to next row"MatchNextRow"Set Cleared to "No"for all rows initiallyTidy upTidy upTidy upApply conditionspecific remainingrulescompare to prev row"MatchPrevRow"Determine which rowscan be matched and which matches to ignore by scanning "down" thetable Counter Generation Table Creator Counter Generation Counter Generation Column Rename Joiner Joiner Rule Engine Rule Engine Column Filter Sorter RowID Rule Engine Java Snippet This pattern will "lag" a set of columns by joining ThisRowNumber to PreviousRowNumber and then ThisRowNumber to NextRowNumber.We tell it to keep ALL columns from the LEFT (upper data port) table and only a subset of columns from the RIGHT (lower data port) table inthe join The java snippet makes uses of a feature that means it remembers stored java variables from onerow to the next. This means that we can determine the outcome for one row based on the storedoutcome from what came from the row immediately prior. This is something the Rule Engine, andmost other nodes cannot do, but it does require a small amount of java, making this now a "low-code" rather than "no-code" solution.For a description of how the java snippet "memory" thing works, see the following post: https://forum.knime.com/t/java-snippets-have-long-memories/33125 Fixed "bug" that previously wasn't spotted as it previously didn't matter.The logic was previously wrong for the joiner nodes, and they way theyworked. This didn't matter for the previous solution, but it would be wrongnow, and would cause confusion. Rule-based RowFilter removedand "common"rules added tostart of both of thetwo new RuleEngines Joiner to join backoriginal data nolonger requiredas Rule BasedRow Filter wasremoved sequentialcounter to providesequentialrow identificationnewsample dataCounter for "Previous row"Counter for "Next row"Renamecounters asThisRowNumberPreviousRowNumberNextRowNumberJoin NextRow and keepspecific columnsrequired for conditionsJoin PreviousRow and keepspecific columnsrequired for conditionsApply conditionspecific remainingrulescompare to next row"MatchNextRow"Set Cleared to "No"for all rows initiallyTidy upTidy upTidy upApply conditionspecific remainingrulescompare to prev row"MatchPrevRow"Determine which rowscan be matched and which matches to ignore by scanning "down" thetable Counter Generation Table Creator Counter Generation Counter Generation Column Rename Joiner Joiner Rule Engine Rule Engine Column Filter Sorter RowID Rule Engine Java Snippet

Nodes

Extensions

Links