Using your data as an example:
(it’s quite a long way of doing it)
Step by step
Create a table using
*(I am going on the assumption that they are all character / dimension objects)
Place a break on and on
3.
Create a new variable: using the formula:
=CountAll( In Body) In ( , )
Create a second variable: <1> using:
=Previous()+","+
Create a third variable: <2> using:
=Previous(Previous()) +"," +Previous() +"," +
Next create another variable: using:
= If = 1 Then Else If = 2 Then <1> Else <2>
In the Break footer use the formula:
=Max(If <> Previous() Then ""Else )
Now you can simply fold the table to display the ,
and all the corresponding values.
Or alternatively to avoid creating a load of local variables use the formula:
=Max(If <> Previous() Then ““Else (If (CountAll( In Body) In ( , ))= 1 Then Else If (CountAll( In Body) In ( , ))= 2 Then (Previous()+”,”+ ) Else (Previous(Previous()) +"," +Previous() +"," + )))