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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shared variable query

Status
Not open for further replies.

sixtoesofdean

Programmer
Nov 6, 2002
26
GB
Hi.

I'm having some problems with shared variables and sub reports:

I have a main report that declares a shared memory variable in a formula (fmlParam). Its job is simply to populate an array with the values of parameters required by the report and it doesn't access any database fields.

This is dropped on the report Header section (which is suppressed)

Below this (in a page header section) is the link to the sub report; The sub report simply displays the array elements set up in the main report - it is infact a common report header used by all reports in the suite.

The problem:
- All the other reports in the suite work perfectly.
- The one I've added errors when attempting to display the sub report on page 2 of main report, saying that "a subscript must be between 1 and the size of the array"

To help a little, here are the formulae:

Main Report
fmlParam:
shared StringVar Array Parameters;
ReDim Parameters[10];
Parameters[1]:= 'Role: All';

Sub report: (there are 10 formulae fmlparameter1..10 - all mapping onto the appropriate array element defined above.
fmlParameter1
Shared StringVar Array Parameters;
Parameters[1]


.... What I don't understand is
(a) Why this set up works in all other reports
(b) Why it works for page 1 of my own report
(c) Why it fails for subsequent pages - like the array is somehow being dropped.

Anyone help?


PS:
I have done a reasonable comparison between my malfunctioning effort and reports that somehow seem to work?

Could it be because I copied the main report formula from another template (using Copy/Paste)

What is going on in Crystal ??

PPS: I'm using CR8.5 with SP1

Cheers
 
I've just discovered that the problem isn't related to the sub-report; If I remove the sub report and simply add a formuala to display element 1 of the array in a detail band, I get the same problem. I.e. Crystal prints the contents of the array element for this first page, but errors on the second / subsequent pages.

I'm not indexing the array with another variable, I'm simply using a formula to display parameters[1]. It looks to me like some sort of persistency problem? Can anyone help ?

Cheers
 
Blimey. For those that are interested, or have similar problems I've discovered the reason:

My report has a number of detail sections that are underlaid. Its this thats causing the problem.

I'm not sure if this is fixed in later versions of crystal, but its a royal pain in the neck.

Now, how I go about finding an alternative solution, I know not, except for seeing what suppressing blank sections achieves....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top