Skip to main content
Solved

Representative Creater - concatenate records

  • October 17, 2022
  • 2 replies
  • 144 views

Forum|alt.badge.img+1

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.

 

 

 

 

Best answer by MayKwok

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

View original
Did this topic help you find an answer to your question?

2 replies

Forum|alt.badge.img+3
  • Data Pioneer L2
  • 16 replies
  • Answer
  • October 17, 2022

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


Forum|alt.badge.img+1

Thanks. Works great.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings