• Old Clarion 4 App

    From susang1952@21:1/5 to All on Sun Apr 17 12:55:29 2022
    I have an old Clarion App I wrote years ago. I was making a change to part of a process to change which records get chosen. Any help is appreciated. I can't seem to get it to function correctly anymore.

    The routine is below, however, what I am trying to do is only use Rounds that have a ROU:PlayDayType of 'R'. But still need to be sorted descending date and descending points.

    The process is a routine to calculate an average score of the Best Scores of Last 6 scores. The RoundsKey is : Rou:ClubID, -Rou:date, -Rou:PointsMade, Rou:PlayDayType

    This is the routine:

    FindPointsAverage routine

    SET(PLA:KeyClubID)
    LOOP until Access:Players.Next()
    clear(Rou:Record)
    ROU:CLUBID = PLA:CLUBID
    Rou:date=Today() + 1
    ROU:PointsMade = 100
    Counter# = 0
    Tally$ = '''

    SET(ROU:KeyRounds,ROU:KeyRounds)
    Loop until Access:Rounds.Next()
    If Rou:CLUBID <> PLA:CLUBID
    break
    END !If player

    If Counter# < 6 AND ROU:PlayDayType = 'R'
    My:Score = ROU:PointsMade
    My:LastDate = Rou:date
    Add(ScoreQ)

    elsif Counter# >= 1000
    Relate:Rounds.Delete(0)
    end
    Counter# += 1
    end ! loop rounds
    if Counter# > 6
    Counter# = 6
    end !if counter

    SORT(ScoreQ,-My:lastdate)
    GET(ScoreQ,1)
    Pla:LastPLAYDate = My:LastDate
    SORT(SCOREQ,-MY:SCORE)
    If Counter#
    SORT(ScoreQ,-my:score)
    case Counter#
    of 1
    EndScores# = 1
    of 2 to 3
    EndScores# = 2
    of 4 to 5
    EndScores# = 3
    of 6 !to 8
    EndScores# = 4

    !**************Changed to best 4 of 6 on !April 15th #August 2, 2019
    END ! case
    LOOP J# = 1 TO EndScores#
    GET(ScoreQ,J#)
    Tally$ += My:Score
    END ! j loop
    IF ENDSCORES# = 1
    PLA:PointsAverage = (TALLY$+PLA:StartingPoints)/2
    ELSE
    PLA:PointsAverage = TALLY$ / ENDSCORES#

    END



    END !if counter
    Access:Players.Update()
    FREE(ScoreQ)
    END ! main loop
    POST(Event:CloseWindow)

    exit
    ! ------------------------------------------------------------------------------------



    Thanks Susan G

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)