I'm a complete Crystal novice, so someone else can jump in to provide
a better solution.. but I was just wrestling with this last week
trying to split the RepList field. Here's what I came up with that
works for me.
For me, I was taking in a database value and splitting it and pushing
it into specific array positions. Your example may be like the
following:
NumberVar ArraySize;
NumberVar i;
StringVar YourString;
StringVar array YourArray;
YourString := "Service ~ Size ~ Length ~ Desc ~ Shipping";
YourArray := Split(YourString, "~");
ArraySize := Count(YourArray);
i := 1;
while i <= ArraySize do
{
<push to array or variable here> = YourArray[i];
i := i + 1;
}
Just as a reference, here's what my final code ended up looking like
in my formula field:
NumberVar intArrayLimit;
NumberVar i;
StringVar repname;
NumberVar repRate;
repname := {?SalesRep};
StringVar array aRepList;
aRepList := split({Command.SalesRepList},"~");
intArrayLimit := Count(aRepList);
NumberVar array aRepRates;
Redim aRepRates [5];
aRepRates[1] := {Command.RepRate1};
aRepRates[2] := {Command.RepRate2};
aRepRates[3] := {Command.RepRate3};
aRepRates[4] := {Command.RepRate4};
aRepRates[5] := {Command.RepRate5};
// Build the string and loop through the string values pushed into
the array
i := 1;
while i <= intArrayLimit do
(
If aRepList[i] = repname Then
repRate := aRepRates[i];
i := i + 1
);
repRate;
--- In
vantage@yahoogroups.com, Muhammad Sarfaraz
<advancegrindingvista@...> wrote:
>
> Hi Need some help to Split a String in Crystal Report
> String = "Service ~ Size ~ Length ~ Desc ~ Shipping"
> I need to Split in each indiviual portion of it.
> I use Split Function but may be I didn't use that proplerly it was
giving me some error "The REsult of a Formula can not be an Array".
> I need to know where i m making mistake or how i can get this done.
> I would really appreciate any help or idea.
> Thanks
>
>
> Muhammad Sarfaraz
> IT Project Manager
> (Vista 8.03.305i - Progress )
> Advance Grinding Service, Inc.
> Tel: (708) 442 7100 x 313
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> [Non-text portions of this message have been removed]
>