Solutions to "Just KNIME It!" Challenge 13

This thread is for posting solutions to “Just KNIME It!” Challenge 13. Feel free to link your solution from KNIME Hub as well!

Here is the challenge of the week: Just KNIME It! | KNIME

Have an idea for a challenge?? We’d love to hear it! :heart_eyes: Feel free to write it here .

1 Like

That was interesting! :smiley:

As usual, I tried to keep the node count to a minimum (replace output columns and exploit missing value behaviour):

  1. Rule Engine to determine desired string length
  2. Substring of Onsite column after removing all non-digit characters
  3. Rule Engine to conditionally fill in missing values with Online column

JKI_013

2 Likes

Hello KNIMErs,

Here is my solution to #justknimeit-13 :

KNIME Hub > gonhaddock > Spaces > Just_KNIME_It > Just KNIME It _ Challenge 013

I’m stuck in a four nodes solution as well, too low for the whole week :face_with_peeking_eye:

BR

PS.- I saw your KNinjas interview… congrats to the participants! … and thank you to the KNIME team for proposing these interesting challenges; I personally learn with all of them.

5 Likes

Hey @gonhaddock,
the missing cells should be taken as they are, no manipulation on those values :wink:

2 Likes

Thank you very much! This means a lot to us. :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

1 Like

Thanks @Thyme
Reading carefully the challenge I think that you are right; a little adjusting and reordering of the nodes took place in my workflow :+1:t4:

2 Likes

here’s my solution

I assumed that the barely structured table was part of the challenge and ended up spending all of the time trying to dynamically parse the structure to a table format.

the trick of the table format was the varying column delimiter using regex. I didn’t wanted to go for the fixed position as you’d be forced to hard type pos and name (or suffer significant amount if nodes)

ASCII Value Tool - Get ASCII Value of Any String
image helped me establish the range of delimiters needed to split dynamically.

I’m pretty sure that I stumbled upon a bug in the “Column Expression” node while using regexReplace as it returns a “Nullpointerexception” if the replace statement is not valid. I circumvented it by adding a try/catch statement in the formula, as that is probably missing in the underlaying java build. @tobias.koetter

image

/cheers

2 Likes

Hi everyone,
Here is my solution.
A table creator and Column expression node

Power of Column Expressions Node

2 Likes

Here’s my solution. I think there’s a typo in the challenge. In the 4th item in the dataset, the first digit is “3”. In the solution its “2”.

REF Challenge 13.knwf (33.8 KB)

1 Like

Very elegant solution. Kudoes!

2 Likes

knime://My-KNIME-Hub/Users/johnpfisk/Public/justknimeit/KNIME_challenge_%20justknimeit-13

Couple of alternatives: one with Column Expression, one with String Manipulation
Very similar to @ersy but without the regex.

1 Like

I’m seeing a tendency of using as little nodes as possible with weird clever tricks. It’s the same as with programming. Once you come back to it to do maintenance you will have trouble understanding your own tricks unless you comment (or in case of KNIME annotate) your work.

It’s a nice theoretical exercise but I think it is bad advice for newcomers. Using many in itself simple and understandable steps is much easier to track after the fact. And you can then just collapse them into a metanode or component and name it correctly.

2 Likes

Not quite certain if anyone noticed yet but in the expected result table seems to be a mistake.

Example table

Index Online Onsite
1 A.6777-01
2 7736-01
3 L-2210341175-00-000020
4 L-3210341175-00-000020
5 F5454
6 B_7736-01-00-000020
7 F5454 7736-01

Expected Result Table

Index Online Onsite Product Codes
1 A.6777-01 677701
2 7736-01 773601
3 L-2210341175-00-000020 221034117500
4 L-3210341175-00-000020 221034117500
5 F5454 F5454
6 B_7736-01-00-000020 773601
7 F5454 7736-01 773601

Index no. 3 “L-2210341175-00-000020” should result in “221034117500” which is correct. However index no. 4 is said to also result in “221034117500” but actually should be “321034117500”, shouldn’t it?

Cheers
Mike

PS: Spottet via Table Difference Finder – KNIME Hub

@kienerj You’re absolutely right, optimisation should never turn into “code obfuscation”.
This is why I’m trying to stick with standard nodes (i.e. no scripting, no extensions) when answering forum questions. Also holding back with smart tricks etc.

However, with the Just KNIME It challenges, nobody is looking for help. We can be creative with our solutions – and they are quite diverse! :blush:

I think that’s one of the goals behind these challenges: To bring a multitude of solutions together so we can learn from each other. I do wild optimisations (single node Java Snippets are my favourite), other people make beautiful dashboards.

3 Likes

PPS: Here are my four solutions

Feel free to AMA and happy “Kniming”

Cheers
Mike

Hi,
here my solution

1 Like

Hi everyone !
My solution to this challenge. I really liked it because we can train ourselves in matters of manipulating strings and with help of regex patterns, we can infer the desired codes, all with only one Column Expressions Node:

image

Nice weekend to all ! :raising_hand_man:

3 Likes

Hello everyone,

here is my solution to this challenge: justknimeit - 13 - Raffaello Barri – KNIME Hub
I decided to keep it simple and used just three nodes. Inside the Column Expression node you can find the task of the challenge. I used regex to extract digits (discarding letters and punctuation) and substr() to cut the required number of digits.

Have a nice Sunday,
RB

3 Likes

My Try on the challenge… a newbee for regex … trying to learn in detail…a powerful approach to extract data… Just Knime IT -Challenge 13 – KNIME Hub

2 Likes

Hello,

I Lost the train on challenge 07 , I trying to catch up.

Here is my solution to this one
Solved 2 ways , one using only one node , columns expressions .
And for the second one a combination of rule engines .
Personally I think that the second one is better, I always get confused with the IFs and ifs combination

1 Like