OFFSET IN Knime

Hi all,

Yesterday i shared a topic about @OFFSET function usage in knime. There is a different need that is relative logic with that. I need a row back update like as example flow.

First 4 columns are input columns and i am trying to create last column. Rule is;

if stock is normal and lag of its all phantom stock rows must be derived with normal until i.th lag of stock not equal to phantom partition by store and product else stock=stock_update. Data is below;

Mycase.knar.knwf (4.6 KB)

Hi @yunusEG,

Regarding the example, the solution is too easy. But there is something I cannot understand in your explanation.

In the example, the stock_update gets changed when the stock is “soos” for the first time and from there the stock_update is always normal. What if there is a “normal” stock before “soos”?

Would you please update your example and consider all potential cases?

:blush:

1 Like

Hi @armingrudd,

Thanks for your interest but there is only one condition if new stock value “normal” and previous is “phantom”, old all “phantom” stocks are going to change as “normal” in same group (in my example:Store,Product).

Maybe, i couldn’t understand your case and if you state the different case clearly, i can update my topic.

Thank you…

1 Like

OK, got it.
Still no loop?

:blush:

I’m sorry about that but you got it :joy:

1 Like

OK, sorry for the delay. I just could work on the issue and here is the workflow to do what you ask: (without using loops or codes)
offset2.knwf (36.2 KB)

I have used a Rank node to add ascending numbers for each group (store and product) and then found the max rank for “normal” values in each group by Pivoting. Then I joined the max rank to the main table and used a Rule Engine to change the “phantom” values to “normal” which their rank is lower than the max rank of the normal value.

I hope this is what you want.

:blush:

2 Likes

Thanks lot @armingrudd,

That’s solution is exactly what i want.

I think partition node is more useful than i think

2 Likes

That’s my 100th solution in the forum. :partying_face: Thank you. :blush:

You mean Pivoting, right? The aggregation nodes are really helpful. I think I have to write a blog post about them… :face_with_monocle:

:blush:

1 Like

Yes, yes Pivoting. :slightly_smiling_face:

1 Like

:clap::clap:

Br,
Ivan

1 Like

100x :white_check_mark: congratulations :grinning: gr. Hans

2 Likes

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