divide / remark rows by sumup result

hi there, may i seek your help on this case.
I need to remark for rows that add up result is greater than or equal to 10. I tried a stupid way using moving aggregator and split the rows hit 10 and the rest rows continue the step of aggregation & split…
but it’s really slow when there’s tons of data.

the sign column is what i want
image

Hi @zerobserver

Could you please present sample outcome table?
I’m not sure what your challenge is, thus sample outcome would help.

Happy KNIMEing,
Kaz

hi, many thanks for the quick reply. The column "Sign " is the result I want. I want to mark out the rows that quantity adds up >=10
image

I also found this script that can be used in column expression node. But the outcome is not I want and I tried to rewrite it but failed :no_mouth:
Result for below expression is ↓
image

set variable count = 0, sign =0

if(variable(“count”) + variable(“quantity”) >= 10
{
variable(“quantity”)
}
else
{
variable(“count”) + variable(“quantity”)
}

if(variable(“count”) + variable(“quantity”) >= 10
{
variable(“sign”) + 1
}

else
{
variable(“sign”)
}

Hi @zerobserver

See this wf divide_remark_rows_bu_sumup_results.knwf (46.5 KB)

gr. Hans

4 Likes

Appreciate your help Hans :rose: :sunflower:!Thank you for your time on this. I learned Recursive loop from your solution. ^^
may i know how should i change the row splitter if my sum target is not fix number. like I have different codes under different sum target.
I just tried set the “sum target” as variable and link to the splitter node, but seems not working.
image

am i wrong using the variable in node row splitter?
image
image

I fixed it :smiley: it’s the type of string/integer diff

1 Like

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