Page 1 of 2

BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Fri Oct 18, 2013 2:59 pm
by jbrita
Amigos aca les dejo una busqueda secuencial en tablas dbf para buscar en cualquier posicion de un campo:


oLbx:bKeyDown := {|nKey| (Search(nKey,@cBusca,oLbx),oLbx:Refresh(),oSay:Refresh()) }


STATIC FUNCTION Search(nKey,cBusca,oLbx)
*--------------

If Nkey=8
cbusca:= SubStr(cbusca,1,Len(cbusca)-1)
DBSELECTAREA(cMa_Arti)
SET FILTER TO
SET FILTER TO AllTrim(cBusca) $ (cMa_Arti)->Ma_Desc
(cMa_Arti)->(DBGOTOP())
IF (cMa_Arti)->(EoF())
SET FILTER TO
Endif
Else
cbusca:= cbusca + Upper(chr(nkey))
* SET FILTER TO
DBSELECTAREA(cMa_Arti)
SET FILTER TO AllTrim(cBusca) $ (cMa_Arti)->Ma_Desc
(cMa_Arti)->(DBGOTOP())
IF (cMa_Arti)->(EoF())
cbusca:= SubStr(cbusca,1,Len(cbusca)-1)
SET FILTER TO
SET FILTER TO AllTrim(cBusca) $ (cMa_Arti)->Ma_Desc
(cMa_Arti)->(DBGOTOP())

Endif

Endif
oLbx:refresh()
oLbx:SetFocus()
return(.t.)

Saludos

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Fri Oct 18, 2013 3:44 pm
by karinha
Use OrdWildSeek() de xharbour.

Salu2.

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Sat Oct 19, 2013 6:16 am
by nageswaragunupudi
Using xbrowse, we do not need to write any code.
It is enough to write two lines of code:

Code: Select all  Expand view
     oBrw:lIncrFilter      := .t.
      oBrw:lSeekWild        := .t.
 


Here is an example:
Code: Select all  Expand view
#include "FiveWin.Ch"
#include "ord.ch"
#include "xbrowse.ch"

REQUEST DBFCDX

function Main()

   local oDlg, oFont, oBrw


   USE CUSTOMER NEW ALIAS CUST SHARED VIA "DBFCDX"
   SET ORDER TO TAG STREET
   GO TOP

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 800,400 PIXEL FONT oFont ;
      TITLE "XBRPWSE : INCREMENTAL FILTERS " + FWVERSION

   @ 30,10 XBROWSE oBrw SIZE -10,-10 PIXEL OF oDlg ;
      DATASOURCE "CUST" AUTOCOLS AUTOSORT CELL LINES NOBORDER

   WITH OBJECT oBrw
      :lIncrFilter      := .t.
      :lSeekWild        := .t.
      //
      :CreateFromCode()
   END

   @ 10,150 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 100,10 PIXEL OF oDlg ;
      COLOR CLR_BLACK,CLR_YELLOW

   ACTIVATE DIALOG oDlg CENTERED ON INIT ( oBrw:SetFocus(), .f. )

return nil
 

Image

Because the dbf is sorted in the order of STREET, the filter is applied to the field STREET.
Entering "FO?D" filtered for "ford" and "fold" found anywhere in the field Street.

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Sat Oct 26, 2013 3:46 am
by juan_arroyo_t
Sr. Rao

El incremental filters desde que version de fwh se puede utilizar ?

Saludos

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Sat Oct 26, 2013 6:24 am
by nageswaragunupudi
August 2011
Version 11.08

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Sat Oct 26, 2013 6:40 am
by juan_arroyo_t
Sr. Rao

Compile con 11.08 y hay un error
Por favor ayudeme

Code: Select all  Expand view
Application
===========
   Path and name: P:\Fuentes\xHarbour\XBrwRao\BIN\XbrwRao.Exe (32 bits)
   Size: 2,078,208 bytes
   Time from start: 0 hours 0 mins 4 secs
   Error occurred at: 10/25/13, 22:28:40
   Error description: Error BASE/1449  Syntax error: &
   Args:
     [   1] = C  

Stack Calls
===========
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:RDDINCRFILTER(4717)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:RDDINCRSEEK(4669)
   Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE:SETRDD(3827)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:SEEK(5957)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYCHAR(2269)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1732)
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(11510)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3443)
   Called from:  => DIALOGBOXINDIRECT(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(277)
   Called from: Source\main.prg => MAIN(33)

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Sat Oct 26, 2013 7:46 am
by juan_arroyo_t
Sr. Rao

Mil disculpas

Me hacia falta el indice

Solucionado, muchas gracias

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Mon Oct 28, 2013 9:42 pm
by davidObarrio
Muchas gracias...

le comento que tengo una aplicación donde le doy la opción para cambiar el orden (3 tipo de ordenes distinto), como vació lo que fue cargado en la búsqueda, y al tomar el nuevo indice como hago un refresh del xbrowse para que se acomode al inicio.

gracias

david

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Tue Nov 07, 2017 6:37 pm
by karinha
Mister Rao, como hago un refresh del xbrowse para que se acomode al inicio?

Gracias, saludos.

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Wed Nov 08, 2017 4:53 am
by nageswaragunupudi
I do not understand your requirement correctly.
Can you please explain clearly?

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Wed Nov 08, 2017 12:06 pm
by karinha
Mister Rao, browse con todos los datos,

Image

Continua...

Saludos.

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Wed Nov 08, 2017 12:09 pm
by karinha
Mister Rao, Hago una busqueda incremental en el xBrowse,

Image

Continua...

Saludos.

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Wed Nov 08, 2017 12:14 pm
by karinha
Mister rao, al volver al browse original, después de la busqueda, no puedo ver todos los registros del BD, solo los datos de la Busqueda.

Image

Gracias, regards, saludos.

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Wed Nov 08, 2017 1:13 pm
by nageswaragunupudi
You are using the same alias in both the browses. In such cases, the changes made to the alias by the second browse are retained even after closing the second dialog. In this case, the filter set by the browse in the second dialog remains.

It is desirable to avoid using the same alias in two or more browses at the same time.

Anyway, in this case, please "clear the filter" when closing the second dialog and refresh the first browse.

Re: BUSCA EN CUALQUIER POSICION CON DBF

PostPosted: Wed Nov 08, 2017 2:47 pm
by karinha
Many thanks mister Rao.

En el xBrowse(), cual és el comando equivalente al,

Code: Select all  Expand view

    oLbx:nColAct := 3  // wbrowse.prg
 


Necesito iniciar el xBrowse en la columna 3

Gracias, saludos.