jul_to_cool
asked on
Split function in Crystal Reports
Hi,
I have a field that holds a string of data separated by a semi-colon ';'. I need to split this string between 1 and 5 fields. Once the string is split I will need to show each field that contains data in the report.
Example of the strings:
Accelerations; Early
Accelerations; Early; Late
Accelerations; Early; Late; Recurrent
Early; Late; Variable; Recurrent
I want to display the split fields as:
Field 1 Field 2 Field 3 Field 4
Accelerations Early
Accelerations Early Late
Accelerations Early Late Recurrent
Early Late Variable Recurrent
I have a field that holds a string of data separated by a semi-colon ';'. I need to split this string between 1 and 5 fields. Once the string is split I will need to show each field that contains data in the report.
Example of the strings:
Accelerations; Early
Accelerations; Early; Late
Accelerations; Early; Late; Recurrent
Early; Late; Variable; Recurrent
I want to display the split fields as:
Field 1 Field 2 Field 3 Field 4
Accelerations Early
Accelerations Early Late
Accelerations Early Late Recurrent
Early Late Variable Recurrent
ASKER
I'm using Crystal Reports 2008.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you use formulas like the ones that mlmcc posted, you would also want to add the following line to the beginning of every formula except the first one:
EvaluateAfter ({@DispField1});
That's to make sure that each of the other formulas is evaluated after DispField1, because it sets the myStrings variable, and the other formulas get their values from myStrings.
James
EvaluateAfter ({@DispField1});
That's to make sure that each of the other formulas is evaluated after DispField1, because it sets the myStrings variable, and the other formulas get their values from myStrings.
James
ASKER
Thanks guys!!!
The best way to handle this is on database side.
Here is an example hot to do this with SQLServer
http://www.codeproject.com/Questions/400165/how-to-split-in-sql-server
You may also use SQLExpressions to get each part of the string