We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

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

Adding to a row, depending on cell

aalleexx
5 - Atom

I have a case where I want to add data to a row, from another row if the numbers matches. I could try to write it down in text but I think it is easier to give the example right away (we always have a maximun of 3 columns to start with)(1,2 and 3 are just row-numbers, not data in cells):

 

    A      B      C

1 11    12     13 

2 13    14     15 

3 20    21     13

 

End-product

 

    A      B      C      D        E        

1 11    12     13     14      15       

2 13   14      15    

3 20   21      13    14      15  

 

So if column C equals column A, I want the data from column A to be added to row 1 (in the first case). It should then find all the instances where this adds up so that everything (from this example) will have the number 15 in the end (since this is the end-number in this case). I also want this to continue to happen since I want the end number to always be 15, so if there is a case where we have add the numbers twice to get to 15, then we should do that. I will give an example below to clarify what I mean here:

 

    A      B      C

1 11    12     30 

2 13    14     15 

3 30    31     13

 

    A      B      C      D     E     F     G

1 11    12     30    31    13   14    15

2 13    14     15   

3 30    31     13    14   15

 

 

Side notes: I do not want it to add row 1 to row 2 (since it will match that way too), in other words it should always add the data from column A.

And I do realize it might have been a douche move to make 15 the end number, and not the highest one, but this is the case in my siutation so I just wanted to make it clear that it just not a matter of arranging the numbers either.

 

I hope I was able to explain myself somewhat, I will be happy to clarify if anything is unclear.

8 REPLIES 8
ShankerV
17 - Castor

@aalleexx 

 

Yes your requirement to add in a row is possible.

But I am little unclear to proceed on the logic how to check and when it should be added.

 

Could you please try explaining once in different way, once logic is clear, the workflow can be built for you.

 

Many thanks

Shanker V

ellen-wiegand
Alteryx Alumni (Retired)

This sounds kind of similar to creating a check digit? Check out this weekly challenge: https://community.alteryx.com/t5/Weekly-Challenge/Challenge-47-Vehicle-Identification-Number-Test/td...

aalleexx
5 - Atom

Absolutely, I will not be using any tables this time just words:

 

I have a sheet with 3 columns (there are more, but the logic will use these 3 and the data ends there today). I'm looking to have the same "end" number on every row (in given example 15). I want to compare the number of column C in every row and if that matches with a number from column A the data that is followed by that number in column A should be added to the row where the numbers matched in column C. To make it as clear as possible I think it's easier to know what it's for. The numbers are actually User IDs, and I want to see who is in charge of everyone for every specific worker. Every row contains a maximum of 3 hierarchy-steps. So A answers to B who answers to C. But C is not the CEO, that is actually E so I have to find the row with C and get the information that C answers to D who answers to E. This would give me the end row with A, B, C, D and lastly E. In some cases it will not only be 6 lines, it could be more, for example: A to B to C, C to Y to D and then lastly a row with D to Q to E. These are all seperate rows but I want the row to be A to B to C to Y to D to Q to E. Then the row that started with C to Y to D will after the processing look like C to Y to D to Q to E.

 

Did this make it any clearer? :) 

Felipe_Ribeir0
16 - Nebula

Hi @aalleexx 

 

One way of doing this (cool problem btw)

 

First input:

Felipe_Ribeir0_1-1668862069018.png

 

 

Second input:

 

Felipe_Ribeir0_2-1668862093491.png

 

 

 

 

aalleexx
5 - Atom

Awesome, I'll try this! Thank you 😁

aalleexx
5 - Atom

Hi again,

 

Is there a possibility to get the configuration in maybe text-form or something? We have an issue with opening foreign files.

If not I'll just have to figure it out in another way, but just had to ask if it is an option 😊 

Felipe_Ribeir0
16 - Nebula

Hi @aalleexx 

 

It worked? Its complicated to explain just by text, it would be better if you could open the workflow and see it.

martinding
13 - Pulsar

I think this is the output you had in mind, but I also think my macro is a bit convoluted and may not be 100% dynamic.

I was hoping this might help people better understand the problem itself, and someone who has more experience and skill than myself could refactor the approach in a better way.

 

Input:

Input.png

Output:

Output.png

Workfllow:

Add row - HR Hierachy.png

Macro:

Test.png

Labels
Top Solution Authors