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

Criteria using Subreports in formula

Status
Not open for further replies.

LSQUARE

Technical User
Aug 22, 2003
15
CA
CR 8.5 user

I'm a novice CR user.

Is it possible to create criteria combining a formula with a subreport?

I'm trying to place a condition between two unlinked tables whereby if the main report table value equals null then I want to use the value listed in my sub-report


Eg. I want to say

if {tableA.name) is not equal to "" then [sub-report {tableB.name}] else {tableA.name}

Or is there a better way to set the criteria?

 
There's probably a way to do this without using subreports, but you'd have to post more info:

Database/connectivity
Example data (show tables and fields)
Expected Output

You can use shared variables to pass data betweeen subreports and the main report (and vice versa).

Example:

Report Header has the subreport
In there you some something:

shared numbervar SubRepValue:= sum({subreptable.field})

In the Report Footer of the main report you could use the following:

shared numbervar SubRepValue;
If sum({maintable.field}) = 0 then
SubRepValue
else
sum({maintable.field})

If you need additional assistance, please don't post theoretical questions, post your complete environment and requirements, otherwise we waste time trying to extract them.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top