Icon

kn_​forum_​48262_​while_​condition_​example_​recursive_​loop

Stop my loop if the column sum is greater than 50% of my flow variable

Stop my loop if the column sum is greater than 50% of my flow variable

-------
if the loop is on the first iteration the temporary table will initially get reset

if($${IcurrentIteration}$$ == null) {
return 1;
}
else if ($${IcurrentIteration}$$.equals(0)) {return 0;}
else {return 1;}

Stop my loop if the column sum is greater than 50% of my flow variablehttps://forum.knime.com/t/stop-my-loop-if-the-column-sum-is-greater-than-50-of-my-flow-variable/48262/6?u=mlauber71 A meta collection about Loops, Switches, Paths and Flow Variables in KNIME (and some ZIP files)https://hub.knime.com/mlauber71/spaces/Public/latest/_loops_and_flow_variables_knime~CET0X2z2VY9oKlYN if the loop is on the first iteration the temporary table will initially get resetif($${IcurrentIteration}$$ == null) { return 1;}else if ($${IcurrentIteration}$$.equals(0)) {return 0;}else {return 1;} https://forum.knime.com/t/stop-my-loop-if-the-column-sum-is-greater-than-50-of-my-flow-variable/48262/12?u=mlauber71 create valuetablecreate valuetablecreate flow varstart looping through itemsSUM(values)STOP if SUM(values)larger than"total value" (INTEGER: 60)create empty valuetable_temp.table=> make sure to reset this_temp.tableadd current valueto the collectedvalues_temp.tableSUM(values)v_select_portcummulativecomputation of values$Sum(values)$ <= $${Itotal value}$$ => TRUEsave_RowIDbring RowIDback Table Creator Table Creator Table Rowto Variable Chunk Loop Start Table Rowto Variable Variable ConditionLoop End Table Creator Table Writer Table Reader Concatenate ReferenceColumn Filter Table Writer GroupBy Merge Variables Merge Variables CASE Switch Start CASE Switch End Java EditVariable (simple) Moving Aggregation Rule-basedRow Filter RowID RowID Stop my loop if the column sum is greater than 50% of my flow variablehttps://forum.knime.com/t/stop-my-loop-if-the-column-sum-is-greater-than-50-of-my-flow-variable/48262/6?u=mlauber71 A meta collection about Loops, Switches, Paths and Flow Variables in KNIME (and some ZIP files)https://hub.knime.com/mlauber71/spaces/Public/latest/_loops_and_flow_variables_knime~CET0X2z2VY9oKlYN if the loop is on the first iteration the temporary table will initially get resetif($${IcurrentIteration}$$ == null) { return 1;}else if ($${IcurrentIteration}$$.equals(0)) {return 0;}else {return 1;} https://forum.knime.com/t/stop-my-loop-if-the-column-sum-is-greater-than-50-of-my-flow-variable/48262/12?u=mlauber71 create valuetablecreate valuetablecreate flow varstart looping through itemsSUM(values)STOP if SUM(values)larger than"total value" (INTEGER: 60)create empty valuetable_temp.table=> make sure to reset this_temp.tableadd current valueto the collectedvalues_temp.tableSUM(values)v_select_portcummulativecomputation of values$Sum(values)$ <= $${Itotal value}$$ => TRUEsave_RowIDbring RowIDbackTable Creator Table Creator Table Rowto Variable Chunk Loop Start Table Rowto Variable Variable ConditionLoop End Table Creator Table Writer Table Reader Concatenate ReferenceColumn Filter Table Writer GroupBy Merge Variables Merge Variables CASE Switch Start CASE Switch End Java EditVariable (simple) Moving Aggregation Rule-basedRow Filter RowID RowID

Nodes

Extensions

Links