ORDWILDSEEK - BUG

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
SALINETAS24
Posts: 667
Joined: Tue Feb 27, 2018 3:06 am
DBs Used: DBF
Contact:

ORDWILDSEEK - BUG

Post by SALINETAS24 »

Hola a todos,

Os paso un programa que permite la búsqueda de cualquier cadena en el campo del indice de una dbf usando la función "ORDWILDSEEK".

El caso es que supongo que será un error, no consigo que tenga en cuenta el primer registro.
He probado de varias formas pero no lo consigo.
Articulo->(OrdWildSeek( cBusca , .T. ,.F.))
Articulo->(OrdWildSeek( cBusca , .F. ,.F.))
.... / ....
Pero con resultado negativo..... :cry:

En el ejemplo tenéis dos GRID, arriba permite busca y bajo para comprobar los registros.
el 1er Registro es

Code: Select all

CODIGO 12 
 NOMBRE  ARTICULO 12
Este articulo es "fantasma" :(

Si en el campo BUSCAR ponemos la cadena "ES" nos mostrará los artículos que contienen "ES"

Code: Select all

CODIGO     NOMBRE
6               ESTANTERIA 6
1               MESA 1 
3               MESITA 3 
2               SILLA RESPALDO 2
Pero si buscas la cadena "ARTI" no aparece....., ¡¡Y ES EL PRIMER REGISTRO!!. :evil:

Si alguien sabe, por el contrario lo solucionare a pedal.., comprobando el primer registro :cry:
Attachments
Ordwildseek.rar
ORDWILDSEEK
(1.26 MiB) Downloaded 98 times
Como dijo el gran pensador Hommer Simpson..., - En este mundo solo hay 3 tipos de personas, los que saben contar y los que no. :shock:
User avatar
gfilatov
Posts: 1116
Joined: Fri Aug 01, 2008 5:42 am
Location: Ukraine
Contact:

Re: ORDWILDSEEK - BUG

Post by gfilatov »

SALINETAS24 wrote: Sun Jan 31, 2021 4:29 pm Hola a todos,

Os paso un programa que permite la búsqueda de cualquier cadena en el campo del indice de una dbf usando la función "ORDWILDSEEK".

...
Pero si buscas la cadena "ARTI" no aparece....., ¡¡Y ES EL PRIMER REGISTRO!!. :evil:

Si alguien sabe, por el contrario lo solucionare a pedal.., comprobando el primer registro :cry:
Hola,

PLEASE TRY THE UPDATED SAMPLE CODE BELOW:

Code: Select all

*--------------------
Static Procedure Buscar
*--------------------

Local cBusca  := "*" + AllTrim(Main.Text_1.Value) + "*"

* Use Articulo
Articulo->(DbSetOrder(1))
Articulo->(DbGoTop())

DELETE ITEM ALL FROM Grid_1 OF Main

If !Empty(Main.Text_1.Value)
 IF Articulo->(OrdWildSeek( cBusca ))  // 1st time call

    ADD ITEM { Codigo , Codigo , Nombre } TO Grid_1 OF Main
    Do While Articulo->(OrdWildSeek( cBusca , .T. ))
      ADD ITEM { Codigo , Codigo , Nombre } TO Grid_1 OF Main
   EndDo 
 Endif
Endif

Main.Grid_1.Value := Main.Grid_1.ItemCount
Main.Grid_1.Setfocus

Return 
HTH :idea:
Kind Regards,
Grigory Filatov

"Everything should be made as simple as possible, but no simpler." Albert Einstein
User avatar
andyglezl
Posts: 1461
Joined: Fri Oct 26, 2012 7:58 pm
Location: Guadalajara Jalisco, MX
Contact:

Re: ORDWILDSEEK - BUG

Post by andyglezl »

Andrés González López
Desde Guadalajara, Jalisco. México.
franco
Posts: 921
Joined: Sat Nov 02, 2013 5:42 am
DBs Used: DBF
Location: Canada

Re: ORDWILDSEEK - BUG

Post by franco »

Just an added note to Grigory`s procedure. I would add upper(cBusca) just so it does not matter about upper or lower data MR. Mr. Smith
or which way you add it text_1.

Code: Select all

Static Procedure Buscar
*--------------------

Local cBusca  := "*" + AllTrim(upper(Main.Text_1.Value)) + "*"                //upper

* Use Articulo
Articulo->(DbSetOrder(1))
Articulo->(DbGoTop())

DELETE ITEM ALL FROM Grid_1 OF Main
If !Empty(Main.Text_1.Value)
 IF Articulo->(OrdWildSeek( upper(cBusca) ))  // 1st time call               // upper

    ADD ITEM { Codigo , Codigo , Nombre } TO Grid_1 OF Main
    Do While Articulo->(OrdWildSeek( upper(cBusca) , .T. ))                   //upper
      ADD ITEM { Codigo , Codigo , Nombre } TO Grid_1 OF Main
   EndDo 
 Endif
Endif


Main.Grid_1.Value := Main.Grid_1.ItemCount
Main.Grid_1.Setfocus
All The Best,
Franco
Canada
Post Reply