Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Index problem
Message
 
À
23/06/2001 17:38:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00522827
Message ID:
00522841
Vues:
10
>>Can anyone help me with the right syntax for an indexkey that sort the following data:
>>cAuktCID  cObjectCID  nOffer    CID
>>"    21"  "    83"    567.00  "   129"
>>"    21"  "    83"    567.00  "   126"
>>"    21"  "    83"    567.00  "   128"
>>"    21"  "    83"    650.00  "   125"
>>
>>
>>I want it to look like this when it's indexed.
>>
>>  Desc      Desc       Desc     Asce
>>"    21"  "    83"    650.00  "   125"
>>"    21"  "    83"    567.00  "   126"
>>"    21"  "    83"    567.00  "   128"
>>"    21"  "    83"    567.00  "   129"
>>I have tried with this, but i does not work:
>>cAuktCID + cObjectCID + STR(nOffer) + STR(VAL(cid)*-1) DESCENDING
>>
>>The 3 first columns gets sorted right but CID-column always
>>ends up in descending order although i use -1 in the calculation.
>>What am i missing here ?
>
>How about
cAuktCID + cObjectCID + STR(nOffer) + STR(999999 - VAL(cid)) DESCENDING
>Also, when indexing on a character expression, remember that VFP uses fixed length index keys. Unless you force the length of the key in the expression, its length will be based on the first record in the table, with unpredictable results. As it happens, in your case STR() defaults to (forces a) length of 10 since the length is not explicitly specified, but this is probably unnecessarily long, making your .CDX files larger and therefore less efficient than necessary.

Hi Al

This is the solution I was trying to achieve. This one I will use. It is nearly the same as Daniel Gramunt mention in another reply.

Thank's Al ,Craig and Daniel for helping me with this one.

/Torgny
/Torgny
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform