Alteryx Designer Desktop Discussions

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

Splitting single row into 2 based on a column

Jasdev
8 - Asteroid

Hi.

I have a scenario for which I have been thinking from a lot time but couldn't figure out how it can be done. 

My input looks like

col1col2col3col4col5
a  12
b34  
    
d5678

 

My output should look like

col1op2op3
a12
b34
  
d56
d78

 

I can figure out a way where either of col2, col3 or col4 col5 are populated, i can use if else to get output. I am not understanding the scenario of splitting col1 where all col2,3,4,5 are populated so I have to split them in 2 different rows. Here, col2 and col3 and one set like cost and quantity for one scenario and col4 and col5 are cost and quantity of different scenario so theyll have values together or will be 0 together. Is there a way to generate the rows completely and split these 2 different scenarios? 

16 REPLIES 16
DavidP
17 - Castor
17 - Castor

How important is empty row c? This deals with everything except row c.

 

DavidP_0-1582154341328.png

 

fmvizcaino
17 - Castor
17 - Castor

Hi @Jasdev ,

 

Example attached.

fmvizcaino_0-1582155880337.png

 

Take a look and let me know if this makes sense to you. 🙂

Best,

Fernando Vizcaino

 

Jasdev
8 - Asteroid

Hi @fmvizcaino 

I used this workflow and it works but frankly i still need to understand what is happening here. I also wanted to ask you if there is any other way to generate a new column saying "type 1" or "type 2" based on if the value is coming from col3, col4 / col5,col6.

Basically if col3 and col4 only has values it will say type 1

col4 col 5 has values it will say type 2

if both have them then when it split it into 2 rows, it says 1st row where value are from 1st set as type 1 and other as type 2. Where neither have value, it can leave empty or maybe say null. 

fmvizcaino
17 - Castor
17 - Castor

Hi @Jasdev ,

 

I've attached a second version of my example for you. I've removed the tiles since it was doing absolutely nothing hahahaha I've also comment some tools to give you information about my whole idea.

 

Best,

Fernando Vizcaino

Jasdev
8 - Asteroid

Hi @fmvizcaino  thanks. I tested this workflow and it doesnt seems to work succesfully when there are more than 1 reference columns like where I have column 1, assume it to be like 5-7 other columns. Col 4,5,6,7 remains same and column "type" remains as is.

The issue that is happening is, for lines having value in col4,5,6,7 doesn't split in 2 lines for me. Something like this: The last line doesn't split into 2.

 

Column 1Column 2Column 3Column 4Column 5quantity type1cost type1quantity type2cost type2
RamUnassigned12345Indus2    
ShyamUnassigned72637Ret20  15
GaganUnassigned46192Indus6110  
JaganUnassigned13842Prop Mgmt6115120
Jasdev
8 - Asteroid

hi @fmvizcaino  any updates?

TomWelgemoed
12 - Quasar

Hi @Jasdev ,

 

Can you confirm what the last line should look like? I know I'm just joining the party 🙂 but your explanation of what rows should stay on the same line in the final data example isn't 100% clear to me.

 

Thanks,

Tom

Jasdev
8 - Asteroid

Hi @TomWelgemoed 

Thanks. Please find below examples of input and output that may make more sense. Input will be:

olumn 1Column 2Column 3Column 4Column 5quantity type1cost type1quantity type2cost type2
RamUnassigned12345Indus2    
ShyamUnassigned72637Ret20  15
GaganUnassigned46192Indus6110  
JaganUnassigned13842Prop Mgmt6115120

 

Output should split all those rows where both (quantity type 1, cost type 1) and  (quantity type 2 cost type 2) has values or both are zero. Output should look like

olumn 1Column 2Column 3Column 4Column 5quantitycosttype
RamUnassigned12345Indus2  1
RamUnassigned12345Indus2  2
ShyamUnassigned72637Ret20152
GaganUnassigned46192Indus61101
JaganUnassigned13842Prop Mgmt61151
JaganUnassigned13842Prop Mgmt61202

 

TomWelgemoed
12 - Quasar

Thanks - I'll work with this and ping you back once done.

Labels