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

Help with a sub report

Status
Not open for further replies.

Blorf

Programmer
Dec 30, 2003
1,608
US
Hello. I don't use Crystal often, so forgive my terms.

I have a pay check report, with a sub report for earnings, and a sub report with deductions.

I need, on the main report, to include an amount that is only found in the sub report, and I have no idea how to do this.

Any info would be appreciated.

The sub report is called EarningsStub3.Rpt, the field, Amount. want the Amount field, only if the "Description" field = "Incentive"

I am sure there is a way.

Thanks,
ChaZ

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.
 
Use shared variables, however the value is only available AFTER the subreport runs.

Here's an example formula for use in the subreport:

whileprintingrecords;
shared numbervar MyValue:= sum({table.field})

Now after the subreport has executed, you can referencre the variable, as in:

whileprintingrecords;
shared numbervar MyValue;
"The value is " & MyValue

Note that you don't describe where the subreport is, which is critical. If it's in a GROUP section, than you'll need to reset the variable prior to running the subreport, as in:

Group header:
whileprintingrecords;
shared numbervar MyValue:=0

Details subreport formula:
whileprintingrecords;
shared numbervar MyValue:= sum({table.field})

Group footer for display:
whileprintingrecords;
shared numbervar MyValue;
"The value is " & MyValue

-k
 
An additional comment: In the subreport, write a formula like:

//{@Incentive}:
if {table.Description} = "Incentive" then {table.amt}

Then for your shared variable within the report, use:

whileprintingrecords;
shared numbervar MyValue:= sum({@Incentive});

Then follow SV's suggestions above.

-LB
 
Hello.

This stuff worked! Thank you!

There Are 10 Types Of People In The world:
Those That Understand BINARY And Those That Don’t.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top