Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Record number in an oredred table
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00763215
Message ID:
00763290
Vues:
18
hi Ali

try this, it's extremly fast even with large tables since it uses Rushmore Technology:
FUNC IndexRecNo
   LPARA ;
      TableToCheck
   LOCAL ;
      IndexExp, ;
      IndRecCount, ;
      CurrIndexValue, ;
      OldRecNo, ;
      OldDele, ;
      OldLock, ;
      OldSele
   OldSele = SELECT()
   IF PCount() = 1
      SELE (TableToCheck)
   ENDIF
   IndRecCount      = 1
   IndexExp      = KEY()
   IF IsBlank(IndexExp)
      * *** no index (order) is set
      IF BETWEEN(RECNO(), 1, RECCOUNT()) .OR. RECNO() < 0
         IndRecCount = RECNO()
      ENDIF
   ELSE
      OldRecNo = RECNO()
      CurrIndexValue   = EVAL(KEY())
      OldLock = SET("lock")
      OldDele = SET('dele')
      SET DELE ON
      SET LOCK OFF
      COUNT ;
         FOR &IndexExp <= CurrIndexValue ;
         TO IndRecCount
      SET DELE &OldDele
      SET LOCK &OldLock
      IF BETWEEN(OldRecNo, 1, RECCOUNT()) .OR. OldRecNo < 0
         GO OldRecNo
      ELSE
         GO TOP
      ENDIF
      IF TYPE("IndRecCount") <> "N" .OR. IndRecCount = 0
         IndRecCount = 1
      ENDIF
   ENDIF
   SELECT(OldSele)
   RETURN(IndRecCount)
ENDFUNC
hope this helps you

>Hi everybody,
>
>Actually, I forget to determine the record number of a record in a table which is oredred. Will somebody please refesh my mind.
>
>Thanks a lot,
>Ali
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform