How to assign ranks in Paradox 7? 
Author Message
 How to assign ranks in Paradox 7?

Hi,
I would be very greatful if somebody can help me with the following
problem. I have a table with 3 fields: year, type, and value.
The table is sorted by year, type, and value (descending), so
that the first observation for a given year and for a given type
has the highest value. I want to assign a rank of 1 to it,
a rank of 2 to the second obs, and so forth until observations
for this year and this type are exhausted. Then, the ranking
procedure should be iterated for another pair of year and type.
The situation is similar to autoincrementing; however,
the field for ranks (already created) should contain several
consequitive sets (e.g., 123451234561234512312345).

Thank you very much.
Dmitry.



Sun, 10 Oct 1999 03:00:00 GMT
 How to assign ranks in Paradox 7?

Quote:

> Hi,
> I would be very greatful if somebody can help me with the following
> problem. I have a table with 3 fields: year, type, and value.
> The table is sorted by year, type, and value (descending), so
> that the first observation for a given year and for a given type
> has the highest value. I want to assign a rank of 1 to it,
> a rank of 2 to the second obs, and so forth until observations
> for this year and this type are exhausted. Then, the ranking
> procedure should be iterated for another pair of year and type.
> The situation is similar to autoincrementing; however,
> the field for ranks (already created) should contain several
> consequitive sets (e.g., 123451234561234512312345).

> Thank you very much.
> Dmitry.

I'm not sure if this is the answer to your question, but I had what I
think was a similar problem and solved it like this.  
My push button was labeled insert and will add the next number (and
store it in a field called No in this example) to as many types as you
have in the same year.  It will also number the first type in a new year
as one (1).

method pushButton(var eventInfo Event)
var
   tc                   tCursor
   num                  longInt
   s                    string  ; I'm treating your year field as a string.
   si                   smallInt
endVar

if not tc.open("TableName Here","IndexName for the Year field here")
then
        errorShow()
endIf
s=year.value
tc.setRange(s,s)

num = tc.cCount("Year")

action(DataBeginEdit)
action(DataInsertRecord)
si=smallint(num)+1
No.value = si
Year.value=s
action(DataPostRecord)
tc.close()
; at this point I didn't close edit, but had it moveTo() the correct
field
; for further data.
endMethod

As you can see I simply counted your fields with the same year and added
1 to the count for the next record.  Perhaps this is too simplistic for
what you are trying to do.  I will be interested in other replies that
you may receive.



Mon, 11 Oct 1999 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. SQL Problem - Assigning ranking value to a percentile.

2. Assigning a Rank to table rows

3. Query problem - Assigning a ranking value to a percentile

4. Trouble assigning TimeStamp@ from paradox table

5. Paradox 4.0 assigning a network printer

6. Assigning unique numbers in Paradox 4.0

7. How can I assign a rank to each record in a resultset?

8. How can I assign a rank to records in a resultset?

9. How can I assign a rank to records in a resultset?

10. How can I assign a rank to records in a resultset?

11. How can I assign a rank to records in a resultset?

12. Win 95 + Paradox = GP 0000 AT PARADOX:28:1323 -- Leaving Paradox


 
Powered by phpBB® Forum Software