Solved

Creating concatenated strings in Crystal

Posted on 2013-12-12
2
231 Views
Last Modified: 2013-12-13
I have a report with multiple detail lines for an item.

there are several records containing type 1 with a description field
several with a type 77 and a description field
several with a description and type 78.

while the detail line is printing(actually suppressed) I want to create 1 concatenated string
for each value and then display those fields in the group header.
0
Comment
Question by:Jeff_Kingston
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 500 total points
ID: 39715165
You can't do it while the detail line is printing since the group header is already printed at that point.

If there is only 1 detail line per group just create a formula that concatenates them together and put it in the group header.

You can create the strings and display them in the group footer.

Basic idea
IN the report header create a formula
Name - DeclareVariables
WhilePrintingRecords;
Global StringVar strType1;
Global StringVar strType77;
Global StringVar strType78;
""

Open in new window


Add a formula to the group header to clear the strings
Name - CLearStrings
WhilePrintingRecords;
Global StringVar strType1;
Global StringVar strType77;
Global StringVar strType78;
strType1 := "Type 1 -" ;
strType77 := "Type 77 -";
strType78 := "Type 78 - " ;
""

Open in new window


In the detail section add a formula to build the strings
Name - BuildStrings
WhilePrintingRecords;
Global StringVar strType1;
Global StringVar strType77;
Global StringVar strType78;
If {TypeField} = 1 then
      strType1 := strType1 & chr(13) & {DescriptionFIeld}
Else If {TypeField} = 77 then
     strType77 := strType77  & chr(13) & {DescriptionFIeld}
Else If {TypeField} = 77 then
     strType78 := strType78" & chr(13) & {DescriptionFIeld};

""

Open in new window


You then need a formula in the group footer for each string to display them
Name - DispType1
WhilePrintingRecords;
Global StringVar strType1;
strType1

Open in new window


mlmcc
0
 

Author Closing Comment

by:Jeff_Kingston
ID: 39716916
This worked slick as you know what   Kudos for the solution and the rapid reply
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question