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!

Main report not recognizing null values in supreport

Status
Not open for further replies.

deb9105

Technical User
Jan 21, 2005
5
US
I created a subreport that pulls company cost for certain medical benefits as of certain date.
I then put the subreport into the main report as directed in a footer section. The main report pulls data from other benefit information. I then have a formula to combine the subreport total of company cost with the total benefit cost from the main report.
The problem is when the subreport encounters a person that does not have the selected criteria benefits for medical from the subreport. In the main report it is pulling data from the previous record and adds the amount into my totals on the main report. I need to know of a formula that if the subreport information is null then do not add the company cost into the main report amounts.
Here is the formula from my subreport. the name in the main report is Main report.
WhilePrintingRecords;
Shared CurrencyVar Companycost:=-({BENEFIT.CMP_FLX_CONT})+{BENEFIT.COMP_CONT}

In the main report formula to add the subreport amounts is
{@Total Cost Benefits}+{@Mainformula}

Can you help?



 
You basically need to reset the shared variable by creating a formula

Code:
Shared CurrencyVar Companycost:= 0;

place it in either the group header or insert another group footer following its use in the main report.

Cheers,
-LW



 
You have some basic misunderstanding of what's happen.

First, it isn't pulling the previous records data, it's as lw suggests, the value has not been reset.

Think of a group in the main report as a loop, and the subreport as having variables.

Prior to executing the subreport, you want to reset the variable, so create a formula as lw suggests prior to running the subreport.

Also you should be specific when using tehnical terms, stating that it's in a footer isn't descriptive, as there are report footers, page footers, group footers...

The theory is that in a group header a (right click the group footer and select insert section below) place the formula containing the variable to reset.

Place the subreport in group header b, and then you can use the results from the subreport, or the 0 if there aren't any, in subsequent sections until the next group begins, in which case the variable in group header a will be reset.

-k

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top