Board index » delphi » Adding Values by Column

Adding Values by Column

I am stuck in a paradox table (using D3) that records times and scores for a
race, in trying to enter the points scored in the float field
'Points_Awarded'.

I want to record the points scored for the race against the position of the
entrant in the race, i.e. 1 for 1st; 2 for 2nd etc. to the end of the number
of entrants.

Having indexed the race results by total time to list the positions in
descending order, done a record count to give me the number that took place
(giving the Max number), I now want to award the points.
I would be grateful for any ideas with suggested code.

Thanks in advance.

Marcus.

 

Re:Adding Values by Column


Well, you haven't given too much info about the structure of the database &
I'm not sure what you mean by "record the points scored for the race against
the position of the entrant in the race." However, I'll make some general
remarks.

First, since you have sorted (by the index) on final position, you can do
something like this:

    with Table do begin
        first;
        while not eof do begin
            TempValue := {do appropriate calculations here};
            edit;
            FloatValue.AsFloat := TempValue;
            Post; {can put in try...except construct for robustness}
            next;
        end;
        first;
    end;

That way, you do the calculations on a per record basis and record it into
the float field. Was that what you needed?

--
Steve F (Team B)

Other Threads