Get data from first occurrence

Hi Knime Community, just want to ask if there is workaround with this scenario, I have 2 datasets (ex. DB1 & DB2) and combine them together to get the supplier name and expense value from DB2. I have successfully get the data but I have to format it in this way:

This was my current process for the DB1 & DB2:

Thank you in advance and appreciate the insights!

Are you asking how to turn everything but the first row to null for Expense, Profit and Profit Margin?

If so, You could use Counter Generation to give you a column with the row numbers and then use an if statement to turn all but the first row to null. (Rank if there are sub groups to ID multiple first rows)

Or you could use the row split to separate out our first row from the rest, a formula to convert the non-first rows to null, then Concatenate back together and sort back to order.

2 Likes

Hi @Heldyyyyy , I have a component that might be able to assist, although it works only on string data, so the data would need to be converted to strings first.

At the end, you can either convert the data back to numbers, and the KNIME table would display “missing values”, or you can leave the data as String and have the KNIME table converted from missing values to empty strings:

Here is a demo:

Blanking repeated data.knwf (169.3 KB)

edit: I just noticed that the “Round Double” node has been renamed to “Number Rounder” in 5.3 :slight_smile:

If opened in 5.2.x, you’ll get the usual warnings about it being written for a later version, but it’ll still work and will look like this:

1 Like

Thank you for the idea @iCFO, I successfully derived the format just change it a little bit since other values to the left is repetitive where it is irrelevant. This was my additional nodes on the above:


1 Like

This approach is so advance for me with the component nodes (I’m still trying to figure out how to connect the component nodes tho to the raw data for future reference) :joy: but this one works too. Thank You for your inputs! appreciate it :grinning:

1 Like

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