Arranging column values

Hello,
My table looks somewhat like this, and I need the result in the Expected format
I have attached the table format:


Can someone please help me out with this, as in Sorter node doesn’t seem to help me in this case. What else can I be using in this scenario, to arrange the column values in user defined format?
Any help would be appreciated, Thank you!

2 Likes

Hi @Saishiyam,

I believe the esiest way to sort the rows as in your final table is to use a -Join- node with a first table (as left table in joiner) created with -Table Creator-node which should contain just the column “A comment” in your right order. Then join by column “A comment” and in the column selection, keep only the columns of your second table (as right table in joiner).

Hope it helps. Otherwise, please post here your table in text format and we will take it from there.

Best
Ael

1 Like

@aworker Thank you for the suggestion, but sometimes more comments might be present, depending upon the input data. In that case, what would be the best approach to solve this?
Here are the table values as requested:

A comment B comment US Count UK Count Grand Total
Ok - no difference NA 23 12 35
Ok tax pop off(part of gov) NA 0 22 22
ICT to check Team to check 12 21 33
Grand total 35 55 90
1 Like

My pleasure @Saishiyam

Sorry I find difficult to understand the logic behind what you need to do. Do you always want to have the N/A at the “B Comment” column appearing in the last rows but before your “Grand total” row ? Is that what you mean ?

@aworker
Actually, this is a pivot created by knime. Now, I want to arrange the ‘A Comment’ column values according to requirements (Like moving the 1st comment to 3rd position and vice verse etc)
This is the requirement. Is it possible to achieve the same?

@Saishiyam I’m still missing the logic of the sorting.

Why should 1st A comment be moved to 3rd position and vice-versa ? Thanks.

@aworker That’s the business requirement and the stakeholders want to maintain that :sweat_smile:

Maybe this answers your question :thinking:

20220525 Pikairos Arranging column values.knwf (40.3 KB)

But still I’m a bit perplex lol :sweat_smile:

Best
Ael

Hi,

aworker’s solution is more solid, but if you want to change the order quickly maybe this can help:

RB

1 Like

If you transpose you can rearange the columns with Table Manipulator manually the way you want it (whatever the Logic might be).
br

2 Likes

Hi @Saishiyam

Did any of the solutions posted here solved your problem ? Feedback would be much appreciated :slight_smile:

Best
Ael

Hi @aworker
Actually I made use of rule engine and created a key column based on the order in which my comments has to appear, and then sorted it in ascending order. That actually worked for me.
Thank you for all the suggestions!

1 Like

Hi @Saishiyam

Thanks for the feedback. Maybe you could post here your solution for the interest of the community :wink:
Best wishes,
Ael

1 Like

Hi @Saishiyam , could you share your solution here so others can benefit as well?

3 Likes

@aworker @badger101 here is what I tried
Reordering rows (1).knwf (10.0 KB)


mentioned the comments in rule engine and assigned key to them and ordered them using a sorter node.

3 Likes

It sounds to me a very wise alternative solutions.
Thanks @Saishiyam for sharing :grinning: :+1:

1 Like

Thanks for sharing! @Saishiyam

1 Like

@aworker Thank you!
@badger101 Welcome!!
:smiley:

Is there any possibility that I can add color to cells dynamically without manually specifying the range?
for eg


I need the grand total row to be colored, but the row which it might be present will differ depending upon the number of comments present. The continental node provides the xls range selector, but that looks more of hard coding way. Is there any other way through which I can achieve this

Hi @Saishiyam

I have posted at the KNIME HUB a generic example on how to dynamically format an Excel Sheet using the Continental nodes:

This example is not doing what you exactly need. You would need from there to customize this component to your needs but the example already covers how to do it for most of the formatting features one would normally need.

Hope it helps.

Best,

Ael

3 Likes