on 04-12-2012 10:50 PM
Hi,
I am creating a report in CR11 where i would like to "sum" all the comments from line items into a single cell or footer.
For example,
The comments in the table could be:
record 1: "load and unload"
record 2: "rig up"
record 3: "march 10 - 12"
I can produce the report with the three line details but I'd rather create a summary that I could join the above comments so that, say, I could put them all one line in the report so it looks like: "load and upload, rig up, march 10 -12".
I tried using the "Insert Summary" function in Crystal however "sum" is not an option when dealing with strings. I can only select "minimum" or "maximum". But I want to select all the comments and join them together. The number of records is not fixed.
Appreciate any help!
thx!
Mark
Welcome back Mark!
Here's what you need to do:
Create a formula and place it on the details section:
whileprintingrecords;
stringvar line;
line := line + {database_field} + ", ";
Create another formula and place it on the Report Footer:
whileprintingrecords;
stringvar line;
left(line,len(line)-2);
Let me know how this goes!
-Abhilash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mark:
You need two different formulas to do this. First formula, place it in Detail section or section where this record is showing, and 2nd in the footer.
lets assume you have these 3 records in 'Detail' section for simplicity. Write the formulas as below and then drag and drop it in 'Detail section'
//Formula 1, place this in your detail section
WhilePrintingRecords;
StringVar strConcat;
strConcat:=strConcat&", "&{TABLE.FieldName};
strConcat;
//Formula 2, place this in footer where you want this concatenated field to be displayed
WhilePrintingRecords;
StringVar strConcat;
strConcat;
So, basically the formula one will append all the values you see in detail section with comma in between and 2nd Formula in footer displays it as concatenated string. You can suppress the 'detail' formula if you dont want to display it...but it has to be dragged in that section in order to be concateneted for each row...Hope this helps..
Mohammed Imran Alam
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.