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

shared variables and multiple sub reports

Status
Not open for further replies.

GretaD

Programmer
Mar 7, 2006
18
0
0
NO
Hi

I'm using CRXI
I have a subreport that contains 3 shared variables (unit, unit_type and currency). The code are similar to this in all 3
whileprintingrecords;
Shared stringvar unit_type:= {UNIT.UNIT_TYPE};
The subreport is placed in the report header of the main report.

These 3 shared variables are to be used both in the main report and in two different subreports. I have created formulas to recieve these variables in main and the subreports that they should be used
shared stringvar unit_type;
unit_type

The problem is that the variables doesn't seem to work in the main and subreports. When I add them to a section below the subreport where they are defined they show up blank (the mainreport are currently returning no rows so this may be the reason).

I also tried to use the unit_type formula field in another formula:
if {@unit_type} = "VOLLUME" then
{DAILY_DEL_LINE.DEL_VOLUME}
else if {@unit_type} = "ENERGY" then
{DAILY_DEL_LINE.DEL_ENERGY};
but got an error message: "A summary has been specified on a non-recurring field."

I tried to use the currency formula in a subreport that returns data and the field turns up blank...

A long explanation here, but I hope it was understandable and that someone can help me!

thanks!
Greta
 
First, you have to figure out why the main report is blank. I don't think you can tell whether the shared variables are working until you get the main report to return results.

Regarding your second issue, I think you need to reference the shared variable directly, not the formula in which it is found.

You realize that your shared variable in the report header subreport will return only one value, right? And I assume you know it should not be linked to the main report on any fields except possibly on parameter fields.

-LB
 
Thanks lbass for always giving good answers.

I know the reason that the main report is blank, there are no data in all the tables I use in this report (it is a new project suffering from lack of test data so far)

I tried to reference the shared variable directly in my formula: shared stringvar unit_type;
if unit_type = "VOLLUME" then
{DAILY_DEL_LINE.DEL_VOLUME}
else if unit_type = "ENERGY" then
{DAILY_DEL_LINE.DEL_ENERGY};
Still got the same error message.

The subreport in the report header only returns one row, so it isn't a problem that the shared variable only returns one row, it is not linked either.

Maybe I just have to wait untill I get data in all the tables before testing this.

Thanks!
Greta
 
I would also place "whileprintingrecords;" in front of "shared stringvar unit_type;", and I agree--you should test after you are able to populate the main report.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top