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

Using numberVar to get a running total

Status
Not open for further replies.

mark12010

IS-IT--Management
Apr 28, 2010
32
0
0
US
I have a report that list all patients who came in to get medication. There are 2 tranaction type values, "Clinic Visit" and "PickUp". I want to run a total on "Clinic Visit". My formula is:
numberVar PICKUPS := 0
iF {inventory_transact_table.transaction_type_value}="Clinic Visit"
Then PICKUPS :=
PICKUPS + 1
I am getting no errors but when I run the report the field PICKUPS = FALSE
Can someone please shed some light on this?
 
From the format, I'm going to assume this is a Crystal report, since that's what your formula looks like. Try this:

numberVar PICKUPS := 0;
if {inventory_transact_table.transaction_type_value}="Clinic Visit" Then PICKUPS := PICKUPS + 1;
PICKUPS

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 

Also, if this formula is in the detail section you're setting the value of the variable to 0 every time, so the displayed value can never be more than 1.

You probably want another formula just to reset the variable to 0, usually that would go in the group header. Then your detail formula would be:

numberVar PICKUPS;
if {inventory_transact_table.transaction_type_value}="Clinic Visit" Then PICKUPS := PICKUPS + 1;
PICKUPS



 
Or, you could just create a running total to handle this - you would set a "Evaluate on" formula of {inventory_transact_table.transaction_type_value}="Clinic Visit" to tell it when to add to the count.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top