Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: split function getting error message Post Reply Post New Topic
Author Message
Keenan
Newbie
Newbie


Joined: 05 Apr 2012
Online Status: Offline
Posts: 2
Quote Keenan Replybullet Topic: split function getting error message
     Posted: 05 Apr 2012 at 5:07am
Hi,
 
I created a main report that passes a variable to the subreport. 
 
Main report:
 

shared stringvar strShowValue2;
strShowValue2:=strShowValue2+totext({@v_percentage})+"^";
 
 

I pass this to my subreport and it shows in subreport as:
 
 
{?Pm-@v2_ShowValue}= 0.00^0.00^95.04^0.00^
 
 
 
When I try to strip this passed variable per following:
 
 
 
 
 I get the message:
 
A subscript must be between 1 and the size of the array.
 
 
Any ideas why this is happening?
 
 
Any help would be greatly appreciated.
 
 
 
 
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 05 Apr 2012 at 5:13am
well, what is recordnumber?
 
of course the next line of attack, would be:
local stringvar array aArray;
aArray = split(parameter);
if recordnumber < Ubound(aArray) then
 tonumber(aArray[recordnumber]);
else
  0;
 
at least this should should help in the debugging.
 
HTH
IP IP Logged
Keenan
Newbie
Newbie


Joined: 05 Apr 2012
Online Status: Offline
Posts: 2
Quote Keenan Replybullet Posted: 05 Apr 2012 at 5:23am

Hi,

Based on my googling of split functions, there was an example that used recordnumber so that was why I used it.  It worked for another report that I did with no problems.  Just this new report which gave me that error.

when I tried to create a formula in my subreport based on your suggestion:

local stringvar array aArray;
aArray = split({?Pm-@v2_ShowValue});
if recordnumber < Ubound(aArray) then
 tonumber(aArray[recordnumber])
else
  0;

 
I get the following error message:
 
 
This array must be subscripted.  For Example: Array
 
 
 
 

 

 

 

 

 

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 05 Apr 2012 at 7:39am
the only thing that comes to mind as I look at the code is:
aArray := split({parameter}, "^")  ;
 
and the split function is missing the delimitor...oops, what you forget :(
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum