Appending a List of Details into One Line:
How do you get a list of detail strings to print on one line? So that a list of detail items like:ItemA
ItemB
ItemC
prints out as one line like:
ItemA, ItemB, ItemC
The solutions requires three formulas, and assumes that the items are within an existing group on the report:
1) In the Group Header place the @reset formula:
WhilePrintingRecords;
StringVar chain := '';
NumberVar ChCnt := 1
2) On the Details place the @Accum formula, putting your field into the second line:
WhilePrintingRecords;
StringVar Item:= {Your.Field}; // place your field in place of {Your.Field}
StringVar Chain;
NumberVar ChCnt;
if ChCnt = 1
then (ChCnt:= 2; chain := Item)
else
// if Length(Chain) + Length(Item) +2 <= 254 then //activate this line if you are using v8.5 or earlier **
chain := chain + ', ' + Item
3) On the Group Footer place the @Display formula:
WhilePrintingRecords;
StringVar Chain
**A string formula in versions before v9 cannot output more than 254 characters. So if your items add up to over 254 characters this formula will error if you don't activate the line that is currently commented out. With that line active the formula will print the items that fit within 254 characters. You can select a number lower than 254 to stop the accumulation earlier, if needed. To get a longer string in versions before v9 you could create a second parallell set of formulas to pick up where this formula leaves off. If you are using v9 or any later version you can delete the commented row, since the new limit is 64,000 characters.