cancel
Showing results for 
Search instead for 
Did you mean: 

Need a Crystal Report formula to concatenate strings during reading records

Former Member
0 Kudos

I have a report that takes partnumbers and cross references them with other partnumbers.

I have this information in the details

Partnumber XRef I need this as the string

A B B

A C B,C

A D B,C,D

And then start the a new string when it gets to a new partnumber. Does anyone know how to do this?

Thanks

siboyd

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Sandra,

in order to create concatenated strings coming in subsequent rows in your "details" area you can either use shared variables or the Previous() function. Take a look in the CR designer help for more information on this.

Regards,

Stratos

Former Member
0 Kudos

I've look at the help and I haven't been able to figure out exactly what I need to do. Each group will have a count at the end so I was thinking I might need some sort of loop formula. Do you have any examples of the formula syntax that I might try? Variables and loop formulas are weak areas of my Crystal report capabilities.

0 Kudos

Hi,

please create a formula field named "MySharedVariableTestGroupHeader" with the following code:

shared StringVar mySharedVar := "Start";

" ";

Then create a second formula field named "MySharedVariableTestDetails" with the following code:

shared StringVar mySharedVar;

mySharedVar := mySharedVar + " Next ";

" ";

Now create a thrid formula field named "MySharedVariableTestGroupFoot" with the following code:

shared StringVar mySharedVar;

mySharedVar;

Insert the newly created formula fileds in your report as follows:

MySharedVariableTestGroupHeader -> Group header section

MySharedVariableTestDetails -> Details section

MySharedVariableTestGroupFoot -> Group footer section

Watch what is displayed in your group footer.

I hope I am able to give you an idea about what you can do by using shared variables in Crystal Reports.

Regards,

Stratos

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks. This was what exactly what I needed. I've been writing Crystal Reports for years but using variables and loops are a real big weakness.

Thanks Again.