Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: "subscript must be between 1 and..." error in BOE Post Reply Post New Topic
Author Message
stonewall63
Newbie
Newbie
Avatar

Joined: 23 May 2012
Online Status: Offline
Posts: 11
Quote stonewall63 Replybullet Topic: "subscript must be between 1 and..." error in BOE
    Posted: 12 Jul 2012 at 11:03am

I have a report in CR 2008 that works great with Crystal itself, but bombs in Business Objects Infoview with the following error:

Error in File ~tmp1d4c7219297c020.rpt: Error in formula TheMonth: '// Find month/year value from footer and add up running total. ' A subscript must be between 1 and the size of the array. Details: errorKind

The job has a pair of arrays that are dimensioned at 13 each. The formula that the job bombs in looks like this:

     // Find month/year value from footer and add up running total.
     local numberVar xx;
     local numberVar yy;
     global stringvar array monyear;
     global numbervar array running;
     redim preserve monyear [13];
     redim preserve running [13];
     for xx := 1 to 13 do
     (
     If monyear[xx] = GroupName ({V_IMG_STUDY.END_EXAM_DTTM}, "monthly") Then
      (yy := xx;
      running [xx] := Count ({V_IMG_STUDY.END_EXAM_DTTM}, {V_IMG_STUDY.END_EXAM_DTTM}, "monthly")));
     monyear[yy] & " --> " & running[yy]

The formula originally did NOT have the redim statments. I added those to see if it would help and it didn't.

Has anyone else run into this? Ideas?

TIA.

Brad
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 12 Jul 2012 at 11:38am
I am looking at your code and wonder how it works at all.  You are doing a comparison against an empty array (If monyear[xx] = GroupName ({V_IMG_STUDY.END_EXAM_DTTM}, "monthly")  ).  monyear needs to be populated with some values.
IP IP Logged
stonewall63
Newbie
Newbie
Avatar

Joined: 23 May 2012
Online Status: Offline
Posts: 11
Quote stonewall63 Replybullet Posted: 12 Jul 2012 at 2:10pm
Oh, I beg your pardon. I had another formula execute beforereadingrecords in the report header that set the array dimensions to 13 and populated the monyear values. As the formula "TheMonth" executes at the group level, it goes thru and based on finding the month/year combo in the monyear array adds to the running total.
 
Sorry 'bout that.
 
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 13 Jul 2012 at 5:54am
Then the question is, what is the GroupName returning?  We have seen some issues where the formatting of numbers and dates change when the report gets posted to the server.

I hope this helps.
IP IP Logged
stonewall63
Newbie
Newbie
Avatar

Joined: 23 May 2012
Online Status: Offline
Posts: 11
Quote stonewall63 Replybullet Posted: 13 Jul 2012 at 4:29pm

Surprise, I figured it out!

 

Look closely at the last line in the formula. I display a couple values from the array to have something declared in the formula, and also for debugging purposes. I was using the variable “yy” as a subscript for the two arrays to show what was in them when done. But “yy” was being set only when the If statement was satisfied, otherwise it was 0.

 

Turns out the data I have coming in assured due to my selection criteria that the If statement would always be satisfied. It worked fine in Crystal Reports and displayed the values properly.

 

But BOE must be fussy when it interprets the running of the formula and kicks out the error.

 

So, I changed the last line to just say “done” and that cleared it up. Phew!

 
As to GroupName, that was also causing an issue which prevented things from adding up in the array properly, once I got the above fixed. The GroupName, while returning the MM/YYYY for my dates, was stripping the leading zero on months 1 - 9. So I had to modify it in the front of the formula to put it into a stringvar and then check its length. If it was 6, tack a "0" in front! Sheesh.
 

Thanks, again.

 

Brad

 

IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.