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

Formula Question

Status
Not open for further replies.

mmt4331

Programmer
Dec 18, 2000
125
0
0
US
Question...I trying to total up the count of dayshift in the field and then display it. Would this be the correct formula and if so, could I put it in the Report Footers? thx.




NumberVar DayShift;
NumberVar NightShift;

if {TurnOver_Logs_v2.Shift} = "Day" then
(DayShift = DayShift + 1)
else
(NightShift = NightShift + 1);

DayShift;

 
I use the BASIC sysntax so I am not totally sure, but I would say that your problem is that you need to declare your variables as "Globals".ie:

Global NumberVar Dayshift;

I hope this helps.

Greg Brouwer, EIT
 
You may want to add
WhilePrintingRecords;
to make sure the results you get are correct.

Other than that, I would suggest using a simpler
approach (no variables needed):

Create a Formula such as:
iif({TurnOver_Logs_v2.Shift} = "Day", 1, 0)
then simply sum it.

Cheers,
- Ido
 
Greg,

Variable scope is not the problem since
Crystal Syntax defaults to Global.
(Basic syntax defaults to Local)

Cheers,
- Ido
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top