Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

How to move one column to the right

Sshasnk
8 - Asteroid

Hi I have a dataset but it is is not align properly because of missing data, now I have to move those columns to the right

 

Example:

Idnameplacequantitypricefruitrow number
456214Alextokyo5.0015.23apple1
456214Raj10.00100.00apple 2
456214Timnew york10.0010.00banana3
456214  25.00125.23banana4
145267EXNickUK5.0020.00apple5
145267EXLuffy5.0060.00apple 6
145267EX  10.0080.00banana7
54123LeoLA5.0010.00apple8
54123  5.0010.00apple9

 

Condition:

1. If you will see row number 2 and 6 the place is missing so to align it correctly I have to move all the columns one to the right

2. If you will look at row number 4 and 9 the alignment is correct So we don't have to do anything

 

Output:

Idnameplacequantitypricefruitrow number
456214Alextokyo5.0015.23apple1
456214Raj 10.00100.00apple2
456214Timnew york10.0010.00banana3
456214  25.00125.23banana4
145267EXNickUK5.0020.00apple5
145267EXLuffy 5.0060.00apple6
145267EX  10.0080.00banana7
54123LeoLA5.0010.00apple8
54123  5.0010.00apple9

 

What will be the best method to push the row to the right

 

Note: We can only use alteryx tools.

 

Attaching the csv file for the above table

5 REPLIES 5
AngelosPachis
16 - Nebula

Hi @Sshasnk ,

 

I have managed to do whta you are looking for with a filter tool and then a union tool, in which I have manually configured the columns.

 

AngelosPachis_0-1607340381380.png

 

That's one way to do it and will solve your problem until you output the data in the right format.

 

Hope that helps

 

Angelos

 

Emil_Kos
17 - Castor
17 - Castor

Hi @AngelosPachis,


This is smart. Easy to implement and easy to explain to others. I will remember this solution for the future. 

 

leon2020
7 - Meteor

@AngelosPachis that's beautifully simple.

 

I had a similar issue myself, and went via a more convoluted route :

  • Create boolean field to identify if row needs aligning, then filter true and false to split into two workstreams.  Something along the lines of ISNULL([place]) OR ToNumber([place])=0 
  • In the true workstream, use Field Info tool followed by RecordID.
  • Add Formula Tool to adjust RecordID (something along the lines of IF [recordID]<2 then [recordID] else [recordID]-1 endif
  • Dynamic rename twice, once to convert field names to rowID, then rowID back to field names the latter using the new, adjusted recordID above
  • Union with the false workstream

It worked, but yours is much more elegant 🙂

 

...and I knew you could do that, clearly didn't occur to me at the time!

AngelosPachis
16 - Nebula

Hi @Emil_Kos and @leon2020 ,

 

I'm really glad that you found this solution helpful and thank you for taking the time to write a comment and share it.

 

Unfortunately, it's a manual process to configure the union tool, but it will work if it's a one-off.

 

Enjoy the rest of your day!

Qiu
20 - Arcturus
20 - Arcturus

@Sshasnk 
Can you also give feedback to your another thread?

I believe the repliers would appreciate your feedback and even better you would mark it as acceptable if you find the anwser useful.

Labels