Grid QueryData from Dbf

Moderator: Rathinagiri

Post Reply
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Grid QueryData from Dbf

Post by hmgchang »

Dear Sirs,

1. I looked into the Grid sample and can not understand how the querydata works on tables. Any sample ?
2. How to sort/index Grid columns ? ( on a ColumnHeaderClick)

thks n rgds
Chang
Just Hmg It !
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Grid QueryData from Dbf

Post by Javier Tovar »

Hello

This is an example to Browse, but it is not difficult to change a Grid, you have to do is identify the column or column header where you make Click, then delete all that this is the Grid, change of index with respect to the Click column where you made and do a Refresh on the Grid.

Code: Select all

*-----------------------------------------------------------------ORDENA POR CLICK EN CABECERA DE COLUMNA----------------------------------------------------
PROCEDURE Ordenar(nCol)
LOCAL nIndice := nCol
LOCAL cIndice 
LOCAL cCadena :=''
LOCAL Ficher  := Alias()
LOCAL cCampo  := ALLTRIM(aCampos[nCol])
LOCAL nPos    := PosiArray(aIndices , cCampo)
LOCAL n
LOCAL i

IF aTipos[nCol]== 'M'
   MsgBox('Este campo no se puede ordenar') 
   RETURN NIL
ENDIF

i:=0
FOR n:=1 TO nCol
   IF aTipos[n] == 'M'
      i:= i+1
   ENDIF
NEXT n

cIndice := 'I' + aIndices[nCol-i]

IF nPos != 0
   For n:= 1 TO FCOUNT()
      PantFiltros.Browse_1.HeaderImages(n) := ccDirRes+'Vacio.bmp'
   NEXT n
   
   PantFiltros.Browse_1.HeaderImages(nCol) := ccDirRes+'Up.bmp'
   cCadena:= Ficher+"->(ORDSETFOCUS('"+cIndice+"'))"
   &cCadena

   GO TOP
   PantFiltros.Browse_1.Refresh
   PantFiltros.Browse_1.SetFocus
ENDIF

RETURN NIL
Saludos
User avatar
hmgchang
Posts: 273
Joined: Tue Aug 13, 2013 4:46 am
Location: Indonesia

Re: Grid QueryData from Dbf

Post by hmgchang »

Thks Bro... I will try...
Just Hmg It !
Post Reply