Crystal Reports 2008 - Array - Only want part of text from Array

Hello,

I have a string parameter that allows multiple values. There are currently 20 options in our database, but there will be more than 20 in the future.

Crystal Reports 2008, Oracle 11.

Example of what string choices looks like:
HD  --High Definition
IP  --Backbone (IP)
L  --Lab/ Test sites

I am able to print what the user select in my page header by using the following formula:   Join ( {?p_SystemTypes} ,  ';   ' )
Example of what Join output looks like:
HD  --High Definition;   IP  --Backbone (IP);   L  --Lab/ Test sites

What I want to display is just the text before the "--"

Example of desired output:  HD; IP; L

Any ideas? Thanks guys.
LVL 14
LinInDenverAsked:
Who is Participating?
 
mlmccConnect With a Mentor Commented:
Try this code.

mlmcc
Local StringVar myString := Join({?Parameter},';';
Local StringVar Array myStringArray;
Local NumberVar i;

myStringArray := Split(myString,';');
For i := 1 to UBound(myStringArray) do
    myStringArray[i] := Split(myStringArray[i],'--')[1];

Join(myStringArray, '; ')

Open in new window

0
 
LinInDenverAuthor Commented:
Thank you!! A parenthesis was missing on var mystring, but once added this does exactly what I need. Thank you!! Thank you!!

Local StringVar myString := Join({?p_SystemTypes},';');
Local StringVar Array myStringArray;
Local NumberVar i;

myStringArray := Split(myString,';');
For i := 1 to UBound(myStringArray) do
    myStringArray[i] := Split(myStringArray[i],'--')[1];

Join(myStringArray, '; ')
0
All Courses

From novice to tech pro — start learning today.