Clarion4 routine not working as planned
- From: susang1952 <susang1952@xxxxxxxxx>
- Date: Tue, 28 Oct 2008 08:37:40 -0700 (PDT)
Have not been using Clarion for a while and there are many cobwebs in
my brain.
I have a program that I wrote for a golf league that calculates their
gross average and handicap differentials. I have used the program for
years with just a point quota for their points made. However, now I
want to add a routine for the gross average and handicap. I seem to
be having some sort of issue with the counter. It takes all scores
not just the last ten.
Here is the senario:
Players File has member number key
Rounds FIle has roundskey, that consist of Player Member Number,
Descending Date, and Points
Here is my ebedded code in the process window code (a little
convoluted, sorry)
FindGROSSINDEX routine
PLA:MEMBERNUMBER = 0
SET(PLA:KeyMemberNumber,PLA:KeyMemberNumber)
LOOP until Access:Players.Next()
clear(ROU:Record)
ROU:MemberNumber=PLA:MemberNumber
Counter# = 0
TALLY5$ = 0
TALLY7$ = 0
SET(ROU:KeyMemberNumber,ROU:KeyMemberNumber)
Loop until Access:ROUNDS.Next()
If ROU:MemberNumber <> PLA:MEMBERNUMBER
break
END !If
if rou:differential > 0 and counter#<10 ! added counter# here
to see if it would make a difference
AV:GROSS = ROU:GROSS
AV:DATE = ROU:date
ADD(AverageQ)
END !DIFF IF
COUNTER# +=1
END! loop
IF COUNTER#>10
COUNTER# =10
END
SORT(AverageQ,-AV:DATE)
TALLY7$ += AV:GROSS
TALLY5$ += AV:DIFF
PLA:GROSSAVERAGE = TALLY7$/COUNTER#
IF COUNTER# < 10
PLA:GROSSIndex = (tally5$+PLA:StartingIndex)/(COUNTER#+1)*.96
ELSE
PLA:GROSSIndex = (tally5$/COUNTER#)*.96
END
IF PLA:grossINDEX = 0
PLA:grossINDEX = PLA:StartingIndex
END
Access:PLAYERS.Update()
FREE(averageQ)
END ! main loop
POST(Event:CloseWindow)
exit
!
------------------------------------------------------------------------------------
In typing the above problem, I may have answered my own question.
However, would still like for someone to take a looksee.
There might be a cleaner way of writing the routine.
Thanks
GG
.
- Follow-Ups:
- Prev by Date: Re: HELP! Clarion 2.1 DOS data file mismatch error
- Next by Date: Re: Clarion4 routine not working as planned
- Previous by thread: ANN: FREE Icon Collection
- Next by thread: Re: Clarion4 routine not working as planned
- Index(es):
Relevant Pages
|