Combination of math formula and rule engine

@takbb you made me laugh haha ha ! We are not going to quarrel about it lol :laughing: ! So funny :rofl: !

@Karlygash has the last word lol :wink: !

Best wishes to you all !

Ael

2 Likes

@takbb @ipazin @aworker thank you for you help :smiling_face_with_three_hearts: and I really appreciate your effort
I would love to use java snippers , but my skills are not enough yet((
@takbb your solution is really great, just one node and proper, cool solution!! I agree with that when you are sharing your workflow other users might not understand it. Specially when your customer asks to load input files by themselves.
@aworker as usually you always give the best solution using KNIME nodes. Actually I haven’t used Rule Based Row Splitter yet(. It is good chance to practice using this node

1 Like

Hi @Karlygash

Thanks for your compliments :relaxed: and glad you find these two solutions useful :wink: :+1: !

I totally agree with the pros and cons of KNIME coding versus classic coding. Having said that, it’s really amazing how sometimes, a single line of classic programming (Java, Python or RegEx) can replace a good dozen of KNIME nodes lol ! @takbb (with Java or Python) and @armingrudd (with RegEx) give us very often the opportunity to learn more, and thus save us from racking our brains the whole day haha ​​ha :crazy_face: ! Kudos again to them !

Have a lovely day :smiling_face_with_three_hearts: !

Ael

3 Likes

Thanks, you too!
Are there any courses ?))related to knime snippers?

1 Like

There is no much difference between the Java/Python/JavaScript used in the KNIME snippets compared to the one used in other environments, so classic tutorials on Java/Python/etc. from the web would be useful to start with. The only thing different you need to know is how to gather the data and how to return the results.

Most often I learn this by looking at simple examples in the KNIME forum or in the hub. One thing I really love about the KNIME web site is that is full of examples associated to every node. For instance, if you need to know how to program in Python with the Python Script node, good places to look at are the following:

You’ll find there explanations and a list of workflows as examples:

or

Be aware that some of the scripting nodes come already along with examples called templates, to illustrate how the data need be gathered and returned:

These are just some hints to start with.

Best wishes,

Ael

5 Likes

Thanks for your links that you provided, I started with Java, but it was a bit tough for me(( Then I moved to python) Hope that in future I can write some extra functions as you using snipper)
Thanks a lot for your help :smiling_face_with_three_hearts: :sparkling_heart:

1 Like

@aworker, hello=)
I am using your solution right now, I have one question related to moving aggregation.
Is it possible to move the row within the group?

For example here in this case I have only one employee, if I add other employees, it moves down appropriately but it is taking incorrectly

Hi @Karlygash and welcome back :slight_smile: !

I guess what you mean is that this should be done separately (independently) based on employee, so the rows for one employee should not be taken into account for the next or the previous employee :thinking: ? Is that the right interpretation ?

Looking forward to helping

Ael

1 Like

@aworker , yeah exactly) :grimacing:
sorry for my poor english)

I have in case uploaded workflow, but the most them are done by you and @takbb :grimacing: :grimacing: :grimacing:
emp_data.knwf (536.9 KB)

Do we have a possibility in knime like window functions in sql?

No problem at all @Karlygash (and your english is perfect :heart_eyes:)

I have downloaded the workflow and I’ll let you know when the solution is implemented.

I’ll be back soon. Hold the line please :laughing: !

Best

Ael

3 Likes

@aworker thanks :green_heart:
Yeah, I m holding the line:D

Hi @takbb

I have just downloaded the last version of the workflow by @Karlygash and while using the last download version of KNIME (4.3.3), I’m facing this problem:

image

and I do not know why. I guess this is working on your side. If so, would you mind to take over from here and reply to @Karlygash question :thinking: ? I believe a solution may be a “group loop” node by employee so the processing is done only based on separate employees. But may be you have a better solution in mind :wink: !

Sorry @Karlygash and @takbb for not been of help here :cry: !

Best

Ael

1 Like

@aworker , oh yes, here are some updates. @takbb implemented new cool components, I installed them and that s why it s asking about updates
Component name is First and Last for Group
image
I do not know how to share with comments:D

Just added link =)

hi @aworker and @Karlygash

yes the workflow contains three copies of a component but clicking Yes to update (or No :wink: ) should allow it to work. However, what I’ve done now is “disconnected” the component from its reference on the hub so hopefully it won’t ask for updates any more.

Apologies for delay, but I had to catch up on the previous messages as I hadn’t been following the “moving aggregation” part of the flow, as I knew that bit was already in (more) capable hands. :thinking: :smile:

However, I think I understad, that basically each time the employee name changes, we need to have the “last” values from the moving aggregation set to missing just as it is for the final row in the dataset.

Assuming I got that bit right, then that “First and Last for Group” component can come to the “rescue”. If we ask it to mark the first and last row for “Employee Name”

image
then what it does is populate two columns “EmployeeStart” and “EmployeeEnd”.

This then makes it super easy to use a Rule Engine to “fix” the “last” values at the end of each Employee window

image

image
image

Is that what is needed? I know it’s a bit of a “cheat” but this is exactly the kind of situation that component was written for :wink:

(And apologies if I’ve misunderstood what was being asked!)

emp_data_2.knwf (619.3 KB)
[Edit: re-uploaded without resetting data :wink: ]

2 Likes

Hi @takbb

Thanks a lot for taking over and the great explanations added to your last message (great as usual :smiley: !)

I believe what you have implemented is absolutely right but @Karlygash has the last word :wink:

What do you think @Karlygash ?

Thanks again !

Take care and enjoy your weekend !

Ael

3 Likes

My pleasure. Good weekend to you too @aworker, and same time again next week? :wink:

4 Likes

Haha ha ! Most probably :wink: !

Good weekend too !

4 Likes

Good Day @takbb @aworker :relaxed:
I really , really appreciate your help and support :green_heart:
From my first workflow, I have learned a lot, thanks to @takbb @aworker !
@aworker you re right, @takbb implementation is absolutely right! :star_struck:
Thank you again :smiling_face_with_three_hearts:
Have a nice day and hope to see you here again))))

2 Likes

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