Clarion4 routine not working as planned



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
.



Relevant Pages

  • Re: Clarion4 routine not working as planned
    ... want to add a routine for the gross average and handicap. ... Rounds FIle has roundskey, that consist of Player Member Number, ... Here is my ebedded code in the process window code (a little ... LOOP until Access:Players.Next ...
    (comp.lang.clarion)
  • Re: Speed Speed Speed - Cutting down on wasted cycles
    ... result of my ignorance on how to best utilize VB6 coding techniques. ... So I had two sections within this one routine that were slowing ... I tacked first the Recordset issue first. ... Now I'm down to a loop that has to perform extensive date manipulation ...
    (microsoft.public.vb.general.discussion)
  • Re: Using ZLib
    ... >> If only it were so easy - I tried using a repeat..until loop, ... >when Count>bytes left, inflate() sets FZRec.avail_out to 0, otherwise ... the main exit condition, and suggest that you check your Delphi CD. ... routine to ensure that they are asking for /exactly/ the decompressed ...
    (comp.lang.pascal.delphi.misc)
  • Re: Math libarary
    ... thought would have been a bette routine than Math.Exp and I was wrong;/ ... Both of these depend on S only but have to take into account the boundaries. ... Right now I have two functions that essentially loop over S seperately. ... The following is the code I use to compute the laplacian of a scalar field. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Whats wrong with this code?? A97 XP SP2
    ... You should be issuing a Debug.Print on *all* of your sql statements so you can easily see where the errors are. ... > routine should use Like (for wildcards) ... > Just working on the first part of the If - Loop for now. ...
    (microsoft.public.access.modulesdaovba)