BUSCA EN CUALQUIER POSICION CON DBF

BUSCA EN CUALQUIER POSICION CON DBF

Postby jbrita » Fri Oct 18, 2013 2:59 pm

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
jbrita
 
Posts: 502
Joined: Mon Jan 16, 2006 3:42 pm

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby karinha » Fri Oct 18, 2013 3:44 pm

Use OrdWildSeek() de xharbour.

Salu2.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby nageswaragunupudi » Sat Oct 19, 2013 6:16 am

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10595
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby juan_arroyo_t » Sat Oct 26, 2013 3:46 am

Sr. Rao

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

Saludos
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby nageswaragunupudi » Sat Oct 26, 2013 6:24 am

August 2011
Version 11.08
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10595
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby juan_arroyo_t » Sat Oct 26, 2013 6:40 am

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)
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby juan_arroyo_t » Sat Oct 26, 2013 7:46 am

Sr. Rao

Mil disculpas

Me hacia falta el indice

Solucionado, muchas gracias
Juan Arroyo
México
FWH 7.12 VERCE 5.3 xHarbour 1.1.0
juan_arroyo_t@hotmail.com
User avatar
juan_arroyo_t
 
Posts: 196
Joined: Fri May 15, 2009 1:25 am
Location: Cuautitlán, Mexico

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby davidObarrio » Mon Oct 28, 2013 9:42 pm

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
davidObarrio
 
Posts: 72
Joined: Tue Oct 02, 2012 4:36 pm

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby karinha » Tue Nov 07, 2017 6:37 pm

Mister Rao, como hago un refresh del xbrowse para que se acomode al inicio?

Gracias, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby nageswaragunupudi » Wed Nov 08, 2017 4:53 am

I do not understand your requirement correctly.
Can you please explain clearly?
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10595
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby karinha » Wed Nov 08, 2017 12:06 pm

Mister Rao, browse con todos los datos,

Image

Continua...

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby karinha » Wed Nov 08, 2017 12:09 pm

Mister Rao, Hago una busqueda incremental en el xBrowse,

Image

Continua...

Saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby karinha » Wed Nov 08, 2017 12:14 pm

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.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby nageswaragunupudi » Wed Nov 08, 2017 1:13 pm

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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10595
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: BUSCA EN CUALQUIER POSICION CON DBF

Postby karinha » Wed Nov 08, 2017 2:47 pm

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.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7766
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Next

Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 42 guests