I am stuck and in need of some desperate help.
Heres what I am trying to do:
I am new to Crystal Reports, I am a Lotus Developer who is using an SQL Driver to pull data from Notes into Crystal Reports so that I can create some fancy reports. The main problem is I have never worked with Crystal Reports, but from what I've seen it is a powerful tool and I'm sure I can split a field 3 times but I'm not sure how to do this.
I am using Crystal Reports 8. I have a field Category_Division.9, which has the following data (this is how it is displayed in Crystal Reports) :
ex. 01 Appliance\02 Needs Repair;02 Carpentry\05 Squeak in floor;10 Brick\01 Broken;21 Drywall\02 Wall Cracks; 01 Appliance\01 Install.
Heres What I would like it to look like:
ex. 01 Appliance
01 Install
02 Needs Repair
In other words the date will be categorized by everything before the "\"
Heres the code I have so far:
Local StringVar Array x;
Local StringVar Array TempArray;
Local Stringvar Temp;
Local Numbervar Remdash;
Local NumberVar loopI;
Local NumberVar loopJ;
Local StringVar CheckStr;
Local StringVar FormulaValue;
x:=Split ({@Size}, ";"
Temp:="";
for loopI:= 1 to ubound(x) do
(
loopJ:=1;
TempArray:=split(x[loopI],"\"
CheckStr:= TempArray[1];
if (instr(Temp,trim(TempArray[1])) < 1) then
(
Temp:= Temp & " | " & TempArray[1];
if trim(FormulaValue) <> "" then
(
if trim(right(FormulaValue,5)) ="" Then
(
FormulaValue:=left(FormulaValue,len(FormulaValue)-5);
);
);
FormulaValue:= FormulaValue & CheckStr & chr(13) & chr(10) & " ";
for loopJ:= 1 to ubound(x) do
(
TempArray:=split(x[loopJ],"\"
if (trim(CheckStr) = trim(TempArray[1])) then
(
Remdash = Instr(TempArray[2],"-"
if (Remdash > 0) then
(
TempArray[2] = Left(TempArray[2],Remdash-1);
);
FormulaValue:=FormulaValue & TempArray[2] & chr(10) & chr(13) ;
if (loopJ <> ubound(x)) Then
(
FormulaValue:=FormulaValue & " " ;
);
);
);
);
);
FormulaValue
I keep getting the following error:
A subscript must be between 1 and the size of the array
What am I doing wrong, does anyone have any other Ideas of how to get this to work?
Maybe a different code I can try that will give me the results that I want.
Is there also anyway to get away from the 254 character limit.
Thanks in advance for all your help
Heres what I am trying to do:
I am new to Crystal Reports, I am a Lotus Developer who is using an SQL Driver to pull data from Notes into Crystal Reports so that I can create some fancy reports. The main problem is I have never worked with Crystal Reports, but from what I've seen it is a powerful tool and I'm sure I can split a field 3 times but I'm not sure how to do this.
I am using Crystal Reports 8. I have a field Category_Division.9, which has the following data (this is how it is displayed in Crystal Reports) :
ex. 01 Appliance\02 Needs Repair;02 Carpentry\05 Squeak in floor;10 Brick\01 Broken;21 Drywall\02 Wall Cracks; 01 Appliance\01 Install.
Heres What I would like it to look like:
ex. 01 Appliance
01 Install
02 Needs Repair
In other words the date will be categorized by everything before the "\"
Heres the code I have so far:
Local StringVar Array x;
Local StringVar Array TempArray;
Local Stringvar Temp;
Local Numbervar Remdash;
Local NumberVar loopI;
Local NumberVar loopJ;
Local StringVar CheckStr;
Local StringVar FormulaValue;
x:=Split ({@Size}, ";"
Temp:="";
for loopI:= 1 to ubound(x) do
(
loopJ:=1;
TempArray:=split(x[loopI],"\"
CheckStr:= TempArray[1];
if (instr(Temp,trim(TempArray[1])) < 1) then
(
Temp:= Temp & " | " & TempArray[1];
if trim(FormulaValue) <> "" then
(
if trim(right(FormulaValue,5)) ="" Then
(
FormulaValue:=left(FormulaValue,len(FormulaValue)-5);
);
);
FormulaValue:= FormulaValue & CheckStr & chr(13) & chr(10) & " ";
for loopJ:= 1 to ubound(x) do
(
TempArray:=split(x[loopJ],"\"
if (trim(CheckStr) = trim(TempArray[1])) then
(
Remdash = Instr(TempArray[2],"-"
if (Remdash > 0) then
(
TempArray[2] = Left(TempArray[2],Remdash-1);
);
FormulaValue:=FormulaValue & TempArray[2] & chr(10) & chr(13) ;
if (loopJ <> ubound(x)) Then
(
FormulaValue:=FormulaValue & " " ;
);
);
);
);
);
FormulaValue
I keep getting the following error:
A subscript must be between 1 and the size of the array
What am I doing wrong, does anyone have any other Ideas of how to get this to work?
Maybe a different code I can try that will give me the results that I want.
Is there also anyway to get away from the 254 character limit.
Thanks in advance for all your help