Skip to main content

I want to concatenate the values of one attribute in a group of records.

 

Input

customer  purchased

0000001   shoes

0000001   belt

0022222   pants

0022222   jacket

 

The output I want is

customer  accumulated

0000001    shoes belt

0022222    pants jacket

 

The representative creater offers best and second to access records in a group, or aggregations like avg, sum. This question asks how to build an expression in a group to concatenate the the values.

I looked at the Record Descriptor steps as maybe offering a solution but the help is very thin.

 

 

 

 

Hi 😇,

You should be able to do the above in Representative Creator.

Define for column “accumulated”, the expression:

concatenate(purchased)

 

If your input is:

customer  purchased

0000001   shoes

0000001   belt

0022222   pants

0022222   jacket

0022222   pants

 

Then the output would be:

customer  accumulated

0000001    shoes belt

0022222    pants jacket pants

 

If you still want the accumulated to show each value only once (i.e. have a distinct operation on it), you can use the expression:

distinct(concatenate(purchased))

Space character is used as default separator. If you wanted a different separator (e.g. |), use expression concatenate(purchased,’|’)

 

Hope this helps?

 

Thanks,

May


Thanks. Works great.


Reply


ataccama
arrows
Lead your team  forward  OCT 24 / 9AM ET
×