Antonio... FiveTouch posts are gone?

User avatar
Antonio Linares
Site Admin
Posts: 42716
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 93 times
Been thanked: 103 times
Contact:

Re: Antonio... FiveTouch posts are gone?

Post by Antonio Linares »

A great article from Rafa Carmona (TheFull) explaining the use of CUSTOM indexes and a working example:

https://xthefull.blogspot.com/2014/02/h ... er-to.html

Code: Select all | Expand

cNombre := "SARAH"

fast_filter( "*"+ alltrim( cNombre ) + "?", 4, 22, 28 )
Browse()


Ahora, ya estaría el filtro activado basado en subindices.

/* 
 Sustituto de SET FILTER
 cExpr  
    Expresion a buscar que forme parte del indice, podemos 
    poner *Texto? , para buscar palabra que forme parte

 nOrder
    Sobre que indice activo vamos a recorrer la lista.
    Por defecto es el indice activo.

 nRow, nCol 
     Posicion fila,columna para mostrar progreso. Se ejecuta en 
     un hilo aparte

 Return: Indice anterior

*/
function fast_filter( cExpr, nOrder, nRow, nCol )
      local PantaAnt := savescreen(0,0,MaxRow(),MaxCol())
      Local p := hb_threadStart( @Pajaritos(), nRow, nCol )
      Local nIndice := OrdNumber()

      DEFAULT nOrder TO OrdNumber()

      set order to nOrder
      INDEX ON &(IndexKey()) TAG _TEMP_ TO tHarbourt ;
               CUSTOM ADDITIVE MEMORY
       
      set order to nOrder
      go top

      DO WHILE OrdWildSeek( cExpr, .T. )
         OrdKeyAdd( "_TEMP_" )
      ENDDO
      OrdSetFocus( "_TEMP_" )
       
      hb_threadTerminateAll()
      restscreen(0 ,0 ,MaxRow(), MaxCol(), PantaAnt)

return nIndice

PROCEDURE Pajaritos( nRow, nCol )
        Local pajarito := "|",n := 0
        
        DEFAULT nRow := MaxRow(), nCol := 1

        DO WHILE .T.

           do case
              case n = 1 
                   pajarito = "|" 
              case n = 2 
                   pajarito = "/" 
              case n = 3  
                   pajarito = "-" 
              case n = 4 
                   pajarito = "\" 
              Otherwise 
                   n := 0
           end case

           DispOutAt( nRow, nCol, "Generando Consulta....[ " +  pajarito +" ]" ) //, "GR+/N" )
           ThreadSleep( 500 )
           n++
       ENDDO
RETURN
regards, saludos

Antonio Linares
www.fivetechsoft.com
MMK
Posts: 15
Joined: Thu Jan 22, 2009 6:24 am
Been thanked: 2 times

Re: Antonio... FiveTouch posts are gone?

Post by MMK »

A temporary index file are really convenient. I use them together with XBROWSE for creation of accumulative filters, WildMatch () and (or) small reports.
Work with them is simple and the universality allows to work with any dbf files without creation of the additional interface.
......
index on &mykey to tsmy_idx for !deleted() CUSTOM ADDITIVE
set order to tag (MOldBag)
......
myblock:=&('{||iif('+bloo+alltrim(znak)+'"'+alltrim(wot)+'",ORDKEYADD("TSMY_IDX","tsmy_idx.cdx",'+mykey+'),)}')
....
dbeval(myblock)
SET ORDER TO TAG tsmy_idx
go top
Post Reply