combining multiple columns into single column

Anusha
Anusha New Altair Community Member
edited November 5 in Community Q&A
Hello Everyone,

I'm trying to combine the necessary columns with a delimiter as "," into a single column, but I'm unable to do that. can anyone please help me?

eg: input data: no of columns=5
reg no      text1      text2     text3         text4
1               an         apple     keeps       away
2               The        sun       rises         in

required output: no of columns=2

reg no       full text
1               an, apple, keeps, away
2                The, sun, rises, in


Thanks in Advance!
Tagged:

Best Answer

  • kayman
    kayman New Altair Community Member
    edited April 2021 Answer ✓
    @Anusha, Try as with attached. The aggregate operator contains a 'hidden' concatenation option which does exactly what you want.
    It's comma separated now, but you can easily change the comma to |: or whatever you prefer.

Answers

  • kayman
    kayman New Altair Community Member
    The aggregate operator allows you to concatenate multiple columns, seperated by any token you like. 
  • Anusha
    Anusha New Altair Community Member
    @kayman, aggregator combines row values but my requirement is combining column values to form a single column. by the way, can you please show, In aggregator where can we change the concatenation separator, the default one "|" but I want to change that to "|:", is it possible?
  • Telcontar120
    Telcontar120 New Altair Community Member
    @Anusha I think the operator you want for this is Generate Concatenation.
    This combines values from separate attributes into a single attribute, and you can also specify the separator character(s) you want to use between them.

  • kayman
    kayman New Altair Community Member
    edited April 2021 Answer ✓
    @Anusha, Try as with attached. The aggregate operator contains a 'hidden' concatenation option which does exactly what you want.
    It's comma separated now, but you can easily change the comma to |: or whatever you prefer.
  • kayman
    kayman New Altair Community Member
    @Telcontar120, the standard concatenation works relatively fine if you have a limited number of known fields, but it's pretty cumbersome to combine multiple fields. The generate aggregation operator allows you to use regex to concatenate multiple attributes in one go, without the need to cleanup ;-) 

    The naming is just a bit confusing here...