Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why is SEEK command showing error?
Message
De
08/09/2004 09:31:47
 
 
À
08/09/2004 05:10:16
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00939863
Message ID:
00940257
Vues:
22
Hi Fabio.

That's pretty clever code. The thing is though, that even if Seek() had a 'DESC' parameter, you still couldn't use it to do what you're doing below because SET NEAR also doesn't mean anything to Seek(). I think it's a bit of an unfair example if what you're really trying to show is the use of DESC. Your example demonstrates more than just the ability for SEEK to use DESC. If you take out SET NEAR ON, you won't get what you want with SEEK either.

I have to admit though, I do like the code. If I ever run into that situation, I'll certainly remember it.

Alan

>
>In order to use SEEK(), you have to set the index order first anyway; so you can set the index DESC and achieve the same result as SEEK with descending order.
>
>Alan
>
>>The differences:
>>- With SEEK you can search with descending order ( for found the bottom ),
>>SEEK() have not this possibility.
>

>
>When I write SEEK() have not this possibility,
>i want say that with SEEK you can do a SEEK in DESCENDING
>( respect to the order, not respect to the data ) for any open index.
>
>A simple example ( it is simple extend it to multiple fields ):
>
>CLEAR
>CREATE CURSOR pippo ( cc C(2))
>
>INDEX ON cc TAG singleTag
>
>* First char of CC is a group marker, second is a subgroup marker
>SET MULTILOCK ON
>=CURSORSETPROP("Buffering",5)
>INSERT INTO pippo VALUES ('A2')
>INSERT INTO pippo VALUES ('A1')
>INSERT INTO pippo VALUES ('A3')
>INSERT INTO pippo VALUES ('C2')
>INSERT INTO pippo VALUES ('C1')
>INSERT INTO pippo VALUES ('C5')
>INSERT INTO pippo VALUES ('C4')
>INSERT INTO pippo VALUES ('B5')
>INSERT INTO pippo VALUES ('B2')
>INSERT INTO pippo VALUES ('B1')
>INSERT INTO pippo VALUES ('B7')
>INSERT INTO pippo VALUES ('B6')
>
>* You want extract the big subgroup for any group, in group ascending order:
>* A3
>* B7
>* C5
>
>* With SEEK you can implement a very fast solution,
>
>SELECT pippo
>SET ORDER TO singleTag
>SET NEAR ON
>SCAN	&& you want go to the last item of LEFT(cc,1) group
>	SEEK LEFT(cc,1)+CHR(255) ORDER singleTag DESCENDING
>	? CC
>ENDSCAN
>SET NEAR OFF
>
>
>The only other solution, without use SEEK DESC, have to scan all records.
>
>Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform