Buen día a todos.
hice un filtro de fecha en una tabla, todo bien pero al quererlo vaciar en un array dentro de un ciclo no puedo usar el DBSKIP(), bi DBGOTOP(). intente con set filter y tambien con DBSETFILTER,
pueden decirme cual es la alternativa para moverme registro por registro en un filtro por favor .
Google traductor
Good day to all.
I made a date filter on a table, was correct, but wanting to empty in an array I can not use the DBSKIP () nor DBGOTOP (). try in Set filter to and also with DBSETFILTER,
can you tell me what is the alternative to moving record by record in a filter please.
codigo:
procedure llenaARRAY
public k,x
public status[4]
k:=1
USE lista new
// set filter to lista->asiste = asistencia.datepicker_1.value
DBSETFILTER( { || lista->asiste = asistencia.datepicker_1.value })
x:=LASTREC()
lista->(DBGOTOP()) // me marca error
Do While ! lista->(Eof())
status[k]:=lista->asiste
lista->(DBSKIP()) // tambien me marca error
k+=1
Enddo
return
saltar registro en un filtro? error DBSKIP()
Moderator: Rathinagiri
-
Javier Tovar
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: saltar registro en un filtro? error DBSKIP()
Hola renegado,
Aquí te mando un ejemplo que hice con tu código en el ejemplo Grid 26 que esta en los ejemplos. El filtro lo llamas con el menu "Filtra Datos".
Saludos
Aquí te mando un ejemplo que hice con tu código en el ejemplo Grid 26 que esta en los ejemplos. El filtro lo llamas con el menu "Filtra Datos".
Code: Select all
/*
* HMG Virtual Grid Demo
* (c) 2009 Roberto Lopez
*/
#include "hmg.ch"
Function Main
Local aValue := { 0 , 0 }
Private bColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , { 245,245,245 } , { 255,255,255 } ) }
Private fColor := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , { 0,0,150 } , { 0,0,0 } ) }
* Grid Column Controls Definitions
aCtrl_1 := {'TEXTBOX','NUMERIC','9999999999'}
aCtrl_2 := {'TEXTBOX','CHARACTER'}
aCtrl_3 := {'TEXTBOX','CHARACTER'}
aCtrl_4 := {'DATEPICKER','UPDOWN'}
aCtrl_5 := { 'CHECKBOX' , 'Yes' , 'No' }
aCtrl_6 := Nil
* Dynamic Display
bdDisplay_1 := { || StrZero(This.CellValue,10) }
bdDisplay_2 := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , Upper(This.CellValue) , Lower(This.CellValue) ) }
bdDisplay_3 := { || if ( This.CellRowIndex/2 == int(This.CellRowIndex/2) , Lower(This.CellValue) , Upper(This.CellValue) ) }
bdDisplay_4 := { || dTos(This.CellValue ) }
bdDisplay_5 := { || if ( This.CellValue == .T. , 'Yes' , 'No' ) }
bdDisplay_6 := { || '' }
DEFINE WINDOW Form_1 ;
AT 0,0 ;
WIDTH 800 ;
HEIGHT 510 ;
TITLE 'Hello World!' ; // ON INIT Filtra();
MAIN
DEFINE MAIN MENU
POPUP 'File'
ITEM 'Append (Alt+A)' ACTION Form_1.Grid_1.Append
ITEM 'Set RecNo' ACTION Form_1.Grid_1.RecNo := val(InputBox('',''))
ITEM 'Get RecNo' ACTION MsgInfo( Str(Form_1.Grid_1.RecNo) )
ITEM 'Delete (Alt+D)' ACTION Form_1.Grid_1.Delete
ITEM 'Recall (Alt+R)' ACTION Form_1.Grid_1.Recall
ITEM 'Get Value' ACTION ( aValue := Form_1.Grid_1.Value , MsgInfo( Str( aValue [1] ) + ' , ' + Str( aValue [2] ) ) )
ITEM 'Set Value' ACTION ( aValue [ 1 ] := val(InputBox('New Row','Selected Cell (Value)')) , aValue [ 2 ] := val(InputBox('New Col','Selected Cell (Value)')) , Form_1.Grid_1.Value := { aValue [ 1 ] , aValue [ 2 ] } )
ITEM 'Save Pending Changes (Alt+S)' ACTION Form_1.Grid_1.Save
ITEM 'Clear Changes Buffer (Undo) (ALt+U)' ACTION Form_1.Grid_1.ClearBuffer
ITEM 'Filtra Datos' ACTION Filtra()
END POPUP
END MENU
USE TEST
INDEX ON CODE TO CODE
@ 10,10 GRID Grid_1 ;
WIDTH 770 ;
HEIGHT 440 ;
HEADERS {'Column 1','Column 2','Column 3','Column 4','Column 5','Column 6'} ;
WIDTHS {100,180,180,100,90,90};
VALUE { 1 , 1 } ;
ROWSOURCE "Test" ;
COLUMNFIELDS { 'Code' , 'First' , 'Last' , 'Birth' , 'Married' , 'Bio' } ;
FONT 'Courier' ;
SIZE 9 ;
COLUMNCONTROLS { aCtrl_1 , aCtrl_2 , aCtrl_3 , aCtrl_4 , aCtrl_5 , aCtrl_6 } ;
ALLOWAPPEND ;
EDIT ;
DYNAMICDISPLAY { bdDisplay_1 , bdDisplay_2 , bdDisplay_3 , bdDisplay_4 , bdDisplay_5 , bdDisplay_6 } ;
DYNAMICBACKCOLOR { bColor , bColor , bColor , bColor , bColor , bColor } ;
DYNAMICFORECOLOR { fColor , fColor , fColor , fColor , fColor , fColor }
END WINDOW
CENTER WINDOW Form_1
ACTIVATE WINDOW Form_1
Return
PROCEDURE Filtra()
public k,x
public aStatus := {}
x:=LASTREC()
DBSETFILTER( { || Test->Code > 5})
Test->(DBGOTOP())
Do While ! Test->(Eof())
AAdd(aStatus, Test->Code)
Test->(DBSKIP())
Enddo
Form_1.Grid_1.Refresh
MsgBox("Registros Antes del filtro" +STR(x))
MsgBox("Registros Despues del fintro"+STR(LEN(aStatus)))
RETURN NIL
Re: saltar registro en un filtro? error DBSKIP()
¡Perfecto!!
Muchisimas gracias por tomarte la molestia Javier Tovar, estaba estancado, pero ahora si puedo continuar.
Hasta pronto y saludos a todos.
Muchisimas gracias por tomarte la molestia Javier Tovar, estaba estancado, pero ahora si puedo continuar.
Hasta pronto y saludos a todos.
-
Javier Tovar
- Posts: 1275
- Joined: Tue Sep 03, 2013 4:22 am
- Location: Tecámac, México
Re: saltar registro en un filtro? error DBSKIP()
Hola renegado,
Siempre trata de subir todo el Demo mínimo completo, aparte del *.prg, tambien *.dbf, *.ntx, *.cdx, etc., para que de esa manera sea más rápida la ayuda!
Y utiliza Sangría para darle facilidad visual. Utiliza el Boton "Code" que esta arriba donde escribimos el Post.
Saludos
Siempre trata de subir todo el Demo mínimo completo, aparte del *.prg, tambien *.dbf, *.ntx, *.cdx, etc., para que de esa manera sea más rápida la ayuda!
Y utiliza Sangría para darle facilidad visual. Utiliza el Boton "Code" que esta arriba donde escribimos el Post.
Saludos
Re: saltar registro en un filtro? error DBSKIP()
Entendido Javier. Tambien estoy aprendiendo a usar el foro.
Gracias.
Gracias.