Skip to main content
andrew_cummins
Helper ⭐️
February 22, 2018

Ability to concatenate within a column via bionic rules

  • February 22, 2018
  • 20 replies
  • 417 views
Currently concatenate only works with bringing together two separate columns of data with the same unique identifier. What I would like to do is concatenate the the same column from multiple rows with the same unique identifier. For instance if you have a project phase with multiple associated assets I would like to concatenate all the asset names into one column for that project phase in an email.

 

20 replies

karl_rumelhart
Expert ⭐️
February 24, 2018
Hi Andrew, Assuming you have a finite list of potential  vales in the Name that you are working with (or whatever the equivalent field is) here is a way you can do it using a Pivot action.  Start with a Dataset task that pulls in the data as in above.  Next create a Pivot task with "Project ID" in the Show and the Group By. 
In the Pivot section drag in the Name field and then click on the gear icon to get the "Pivoted conditions to evaluate" screen.  You will add one line in this config for every field value in Name.  For example, you would have Pivoted Field = Name, Operator "=", Value "Telephone"   Aggregation "MAX" (won't actually do anything), Field is "Name" with no Default Value and then Field Label "Telephone".   You would then do similar things for Internet, Television and any other values that you care about. 
What you end up with is something like this

Project ID || Telephone || Internet || Television
123           || Telephone || Internet || 
345           ||                   || Internet ||
456           || Telephone ||               || Television

You can then create a final Transformation task that uses the Concat function to replace the pivoted columns with one column that concatenates the string values.  (You can add spaces or commas, too, but the UX is a bit tricky.) 

I hope this helps!
andrew_cummins
Helper ⭐️
February 24, 2018
it is not a finite number. It can be 5 or 10 or 20 assets
seth
Expert ⭐️
March 7, 2018
Andrew, I think this might work for you anyways. If the result of the Pivot is null, then that value simply doesn't get included in the concat.

The way I'm doing it is:
  1. Use a Formula Field in a Transform Task to concatenate each "Name" with " // ". So, in your example, each record for "Telephone" becomes "Telephone // " So, when they're concatenated together, it'll look like "Item 1 // Item 2 // ".  (Not perfect, but not terrible.)
  2. Do the pivoting that Karl describes above. (Make sure to use MAX, as he recommends. I first used "COUNT", which produces a numerical output, which can't be included in a concatenation.) I have 7 possible options, so my setup of the Pivot field looks like this: [img]https://uploads-us-west-2.insided.com/gainsight-us/attachment/RackMultipart20180307-104427-1btq1f8-Image_2018-03-07_at_3-46-32_PM_inline.png[/img]
  3. Use a Transform Task to concatenate all of them together: [img]https://uploads-us-west-2.insided.com/gainsight-us/attachment/RackMultipart20180307-49572-1upa433-Image_2018-03-07_at_3-49-18_PM_inline.png[/img]
AI Transformation @ Gainsight
kevin_ly
Helper ⭐️
March 8, 2018
I could see a dynamic "concatenate contact column grouped by a value" being valuable in the future. That way if there is an additional new string, one wouldn't have to go back to the pivot and add it.
andrew_cummins
Helper ⭐️
March 12, 2018
yes, but I do not have only 7 possible options. I never know how many options I have. so I have no idea how many times I would need to concatenate. 
karl_rumelhart
Expert ⭐️
March 12, 2018
I agree with you, Kevin.  I think what would really work for Andrew's use case is a new aggregation option when grouping by a value -- instead of Count or Count Distinct he could use a Concat.   
Are there other aggregation options that would be useful in different use cases (and with different data types)?
andrew_cummins
Helper ⭐️
March 12, 2018
So we are saying the functionality is not currently available and that the above suggestions with the current functionality will not work for my use case right? I just want to make sure I have not missed something or not understanding something. 
karl_rumelhart
Expert ⭐️
March 13, 2018
I am not able to think of a way to do this when there are no bounds on the potential column values and you don't want to group them into a finite set.  (Not saying that someone else might not be able to come up with an approach!) The group-by aggregation enhancement would fit the use case pretty cleanly. 
seth
Expert ⭐️
March 14, 2018
Hi Andrew -- I think what I picked up from your description is that you [i]do have a finite list of potential column values, but you just don't know how [i]many of them will be present for a given record. If that's the case, then that matches my situation, so my approach should work for you. That may make you read my description above thoroughly for the first time 🙂 So let me know if there's anything I can clarify!
AI Transformation @ Gainsight
andrew_cummins
Helper ⭐️
March 14, 2018
Thanks Seth. I do not have a finite list. there are so many combinations things....exponential variables per say.