Page 1 of 1

Order in a Grid

Posted: Mon Sep 03, 2012 7:22 pm
by danielmaximiliano

Hi guys:
looking at the forum, I found several ways to filter a table.
some with SET FILTER TO or ORDSCOPE as some faster than SET FILTER
wanting to apply it to the grid unresponsive see, I'm doing something wrong, or need to supplement with some other function???

Code: Select all

Procedure Filtar()
Local cDesc := ''

cDesc := UPPER( InputBox ( "Buscar Artículos", "Buscar : " ) )
cDesc := AllTrim( cDesc ) 
If .Not. Empty ( cDesc ) 
  PRODUCTOS->( OrdSetFocus( "SCS" ) )
  SET FILTER TO cDesc $ Productos->SCS
  Stock.Articulos.Refresh
Endif

Return
income in the inputbox 'shampoo' to filter the grid with this article and ignore.
Stock Autoservicio Los Tilos_2012-09-03_16-07-06.jpg
Stock Autoservicio Los Tilos_2012-09-03_16-07-06.jpg (161.98 KiB) Viewed 2755 times

Re: Order in a Grid

Posted: Mon Sep 03, 2012 8:01 pm
by IMATECH
Hi danielmaximiliano !

Please, try this code:

Code: Select all


Procedure Filtar()
Local cDesc := UPPER( InputBox ( "Buscar Artículos", "Buscar : " ) )

cDesc := AllTrim( cDesc )

If .Not. Empty ( cDesc )

  // Bag Order: make sure it exists
  Productos->( OrdSetFocus( "SCS" ) )

  // Initial and Final range filter
  Productos->( ordscope( 0, cDesc ) )
  Productos->( ordscope( 1, cDesc + 'Z' ) ) // Try to remove + 'Z' after test

  // Top of File
  Productos->( DBGOTOP() )

  // Browse Data
  Stock.Articulos.Refresh()

Endif

Return

Static Function F_Clear_Filter( cAlias )
  LOCAL lRet := .T.

  // Clear Range
  ( cAlias )->( ordscope( 0, NIL ) )
  ( cAlias )->( ordscope( 1, NIL ) )

Return( lRet )


Re: Order in a Grid

Posted: Mon Sep 03, 2012 8:11 pm
by danielmaximiliano
Funciona Perfecto :
muchas gracias Ronaldo
Stock Autoservicio Los Tilos_2012-09-03_17-06-35.jpg
Stock Autoservicio Los Tilos_2012-09-03_17-06-35.jpg (106.88 KiB) Viewed 2744 times