Alteryx Designer Desktop Discussions

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

Concatenate Columns based on Arbitrary number of Label Columns

MarkBelisle
5 - Atom

Hi all,

 

I'm looking for a way to create a concatenated column based on an arbitrary number of "Label" columns which are brought in through an input file.

e.g.

Input

IDLabel_1Label_2...Label_nother columns
1xaanything<null>Dog
2ybanythingqCat
3xbanythingwBirb

 

Output

IDLabelsother columns
1x, a, ...Dog
2y, b, ..., qCat
3x, b, ..., wBirb

 

I won't know how many Label columns there are, but there will always be at least 1. Ideally concatenated by comma delimited, and Null values should be ignored. I can remove the "Label" columns myself.

Any column that doesn't start with "Label" can be ignored, but should remain in the data set.

5 REPLIES 5
Felipe_Ribeir0
16 - Nebula

Hi @MarkBelisle 

 

One way of doing this dynamically

 

Felipe_Ribeir0_0-1673369931486.png

 

Felipe_Ribeir0
16 - Nebula

Unfortunately, to do it dynamically the only ways that i know about are by transposing the data or using a iterative macro.

 

These methods can demand to much computing power with large datasets. IF you also feel that the multi field formula could be enhanced to do this job, please vote for this idea :)

 

https://community.alteryx.com/t5/Alteryx-Designer-Ideas/Enhancement-on-the-Multi-Field-formula/idi-p...

 

MarkBelisle
5 - Atom

1) That the Multi-Field formula could be able to evaluate a set of columns dynamically and generate just one new column (the sum of the evaluated columns, the concatenation of it...).

 

I agree. My first thought was using multi field formula; something like:

 

IF Contains([_CurrentFieldName_], "Labels") THEN

[_Concatenated_Labels_][_Concatenated_Labels_] + ", " + [_CurrentField_]

 

ELSE ...

ENDIF


Is there a way to modify a different field in the same row than the one currently being checked by Multi-Field? I believe that would solve the problem..

 

Felipe_Ribeir0
16 - Nebula

@MarkBelisle unfortunately, i am afraid that you wont be able to solve this with the multi field formula. I am 99% certain about this, but i would be very happy if someone else could show us a way to do this 😁

MarkBelisle
5 - Atom

Indeed. I was really hoping it was possible with the multi field too.

 

I've accepted your solution - the dataset I'm running on should remain small enough that processing won't become an issue. I've upvoted your aforementioned Enhancement as well.

 

Thank you for your help!

Labels