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

How do I put conditional record count in Report Header

Status
Not open for further replies.

Bullfrog1870

Technical User
Dec 26, 2005
15
US
I have a parameter that the user enters (OrderSalesLimit). I'm wanting the report header to say: "There were (x) orders with a sales limit of (y) or greater."

I tried the following but it did not work. It only ever shows a value of 1.

Global NumberVar iCounter;
whileprintingRecords;
if {OrderTotal} > {?OrderSalesLimit} then iCounter := iCounter + 1;
"There were " + ToText(iCounter) + " orders with a sales limit of " + ToText({?OrderSalesLimit}) + " or greater."

Thoughts?

CR11/SQL2K/ODBC
 
Create a formula {@Grthanlimit}:

if {table.ordertotal} > {?OrderSalesLimit} then 1

Then for your report title formula, use:

"There were " + ToText(sum({@Grthanlimit}),0,"") + " orders with a sales limit of " + ToText({?OrderSalesLimit}) + " or greater."

This assumes that the order total is a database field, not a summary, and that there is no row inflation.

-LB



 
That appears to have been the core of my problem. I was using a formula field versus a table field.

This gets me wondering. Why does CR act differently when looking at a table field versus a formula field? Why should it care where the recordset comes from?

 
I'm not sure what you are referring to. Your first formula would only work in the report footer, since it is basically a running total.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top