Split value column into 2 columns

image
Hi,
I want to transform my data to split a column in two so it lines up as in the table attached.
Any help would be appreciated.
Thanks.

You could stack two rule engines and create your 2 columns (Name =“x” =>Name) and then same for y

1 Like

Hi @AidanByrne
Good day!

How about if condition in math node, but you may need to change the value in Name column.

(1) Rule engine
$Name$ match “x” => 0
$Name$ match “y” => 1
(append to new column)

(2) Math
if($Newcolumn$==0,$Value$+0,0) (Append to new column with name Value x)

(3) Math
if($Newcolumn$==1,$Value$+0,0) (Append to new column with name Value y)

Regards,
Charm

1 Like

Hi @AidanByrne,
there are various solutions beside the previous described possible. You can also use a java snippet node to solve it. Further you can use the pivoting node keeping the rowid or rowindex as group condition.

BR

3 Likes

Thanks for the reply.
I used a simplistic table to show what i wanted to achieve.
In reality the rows contain more than x or y but do have x or y in the name.
Is there a way to use a wildcard in the rule engine because I just seem to be getting syntax errors when I use *?

Thanks for your suggestion.

In reality the contents of each row changes and the name look more like: (Nominal x, Actual y…)
Is there a way to use a wildcard in the rule engine?
I get a syntax error when I use *?

1 Like

Thanks for the reply.
Would you have an example of a java snippet that would solve this issue?

How about this way?

Rule engine
$Name$ match “Nominal x” => 0
$Name$ match “Actual y” => 1
(append to new column)

If you have still a syntax error, can you please share with screenshot?

Thanks for your answer, I got this working now using $Name$ match “x” => 0

2 Likes

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