Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with Shared Arrays- multi Subrpts

Status
Not open for further replies.

Ngolem

Programmer
Aug 23, 2001
2,724
CA
I need help...

Awhile back I described a problem where I had to "Dovetail" records together from several sources.

Well I solved it...and am one freaking bug away from finishing the report.

I have 4 subreports in the reportheader1a that collect the data for each respective subreport into a common string format that is parsed out later in the main report. The Date records are grouped descending in all cases

reportheader1a is not suppressed but the details in each subreport are so nothing is returned to the report here.

In a second Report sectionb which is suppressed I pass the shared arrays to a function {@combine} which looks at the date portion of the string of each shared array and decides which is the newest and creates another string array that dovetails the records in order (AND IT WORKS BEAUTIFULLY...most of the time)

Occasionally I get an error:

"A subscript must be between 1 and the size of the Array"

My test data is very small when this error happens with each array returning less than 10 records, having been dimensioned for 500 with "" as the initail values.

The subreports seem linked properly since I make the details of each subreport visible and put a "Can GRow" on the field in the main report...and they appear as they should.

But I get this error when the report proceeds passed that point.

I initialize each counter in each array to 1 so it isn't that I am starting at zero and I return the number of records of each shared array so I am not proceeding past the array....

DOES THIS ERROR HAVE ANOTHER MEANING???

Any help...very much appreciated...Jim
 
It is OK....I found the bug....

An "If" structure was the problem in each subreport.

Let it be known that a formula in a detail section is executed at least once in a detail section...EVEN IF NO DATA IS RETURNED...or so it seems

So I was getting counters incremented when I had no data in a subreport.

When a formula fails because data is null...it still performs operations ahead of the failure...so a counter was incremented before the formula failed...and this shared variable was sent back to the main report.

the solution was to wrap that formula in a "If Not isNull() then" format on each variable prior to entering the critical part of the formula...to prevent the spurious increment.

Will another challenge done...this was a fast way of "DoveTailing" records too....the 4 subreports had about 20,000 records each and finding/sorting/displaying appropriate data took between 20 - 40 secs.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top