FoxPro/Visual FoxPro - grid actualiza informacion erronea vfp6

 
Vista:
sin imagen de perfil

grid actualiza informacion erronea vfp6

Publicado por andrey (5 intervenciones) el 10/08/2023 15:27:23
form1 procedimiento init
use C:\dbfs\pr in 0 shared

select doc, lastn, mname, name, phone, state,obs, apprvd;
from pr ;
where pr.state = 0 or pr.state = 5 into cursor f_temp1

select f_temp1
afields (f_temp_f)
create cursor f_temp from array f_temp_f
append from dbf('f_temp1')

Thisform.pr.RecordSource = "f_temp"

with thisform.pr
.recordsource = .recordsource
endwith

Thisform.pr.column1.ControlSource = "f_temp.doc"
Thisform.pr.column2.ControlSource = "f_temp.lastn"
Thisform.pr.column3.ControlSource = "f_temp.mname"
Thisform.pr.column4.ControlSource = "f_temp.name"
Thisform.pr.column5.ControlSource = "f_temp.phone"
Thisform.pr.column6.ControlSource = "f_temp.state"
Thisform.pr.column7.ControlSource = "f_temp.obs"
Thisform.pr.column8.ControlSource = "f_temp.apprvd"

thisform.pr.setfocus()
Thisform.pr.refresh
thisform.refresh

boton approved procedimiento click

select f_temp
go top
scan
If f_temp.apprvd = .T.
select f_temp
replace f_temp.estado with 4 for empty(f_temp.desc_obj)

SELECT f_temp
for ve = 1 to reccount()
select f_temp
go ve
If f_temp.apprvd = .T.
update Pr set pr.estate = f_temp.state where pr.doc = f_temp.doc
endif
endfor

endif
endscan

select f_temp
go top
scan
If f_temp.aprobado = .T.
select f_temp
replace f_temp.estado with 5 for !empty(f_temp.desc_obj)

SELECT f_temp
for ve = 1 to reccount()
select f_temp
go ve
If f_temp.apprvd = .T.
update Pr set pr.estate = f_temp.state where pr.doc = f_temp.doc
endif
endfor

endif
endscan


select doc, lastn, mname, name, phone, state,obs, apprvd;
from f_temp ;
where f_temp.state = 0 or f_temp.state = 5 into cursor f_temp2

Thisform.pr.RecordSource = "f_temp2"

with thisform.pr
.recordsource = .recordsource
endwith

Thisform.pr.column1.ControlSource = "f_temp2.lastn"
Thisform.pr.column2.ControlSource = "f_temp2.lastn"
Thisform.pr.column3.ControlSource = "f_temp2.mname"
Thisform.pr.column4.ControlSource = "f_temp2.name"
Thisform.pr.column5.ControlSource = "f_temp2.phone"
Thisform.pr.column6.ControlSource = "f_temp2.state"
Thisform.pr.column7.ControlSource = "f_temp2.obs"
Thisform.pr.column8.ControlSource = "f_temp2.apprvd"

thisform.pr.setfocus()
Thisform.pr.refresh
thisform.refresh

cuando le doy click en el boton approved en el grid solo se muestra los registros que tienen el campo obs lleno, no muestra los campos que tienen state 0, obs vacio y que no fueron seleccionados por el check.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

grid actualiza informacion erronea vfp6

Publicado por Javier Dillon (3 intervenciones) el 18/08/2023 00:54:47
Hola Andrey:

Cuando actualices o presentes una grilla, antes de cargarla o recargarla es conveniente hacer
.RecordSource = ''
este blanqueo es necesario.
y luego de hacer los cambios en 'mi_archivo', recién hacer:
.RecordSource = 'mi_archivo'
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar