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!

Formula/Summary field at the end of a report

Status
Not open for further replies.

Razzle00

Programmer
Sep 27, 2006
20
US
Hi,

I need to create a report that has just 1 field in the summary band of the report (or report footer) that is a sum based on an expression like IIF(MyTable.MyField = True, 1, 0). There is no detail band,group band or and other fields. Just a summary field at the end of the report. How could I do this? Could it be done with sum(fld,condfld,cond)?

Thanks,

Razzle

 
Place your formula in the detail section and right click on it and insert a summary (sum, not count) at the grand total level. You can then remove the formula from the detail section.

Note that you are better off not using iif in CR as it sometimes fails when nulls are involved. Try using a simple if/then formula instead.

-LB
 
LB, I would rather not create a field in the detail band and then create a sum from that because once you delete the field from the detail band you cannot ever change the expression without recreating another field in the detail band. Can it be done with a formula field instead? How would you create a If/Then statement that is equivalent to
IIF(MyTable.MyField = True, 1, 0).

Thanks,

Razzle
 
Sure, make the first formula {@cond}:

if {MyTable.MyField} then 1

...and then reference it in a second formula:

sum({@cond})

...and place this in your report footer.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top