Comparing and logging changes
Posted: Sat Nov 12, 2011 1:58 pm
Roger,
Earlier you suggested that we use the scatter before and after when a user is updating a master file to create a log file for changes.One part I cannot get to work, and its got me stumped.
//array1:=tractor->(scatter()) is loaded when record is opened. After the save, here is the code to update our log file
aArray2 := tractor->(Scatter())
nnn=1
do while nnn<=len(aArray1)
if aarray1[nnn]<>aarray2[nnn]
do uplog with "T",tractor->number,fieldname(nnn),aarray1[nnn],aarray2[nnn]
endif
nnn=nnn+1
enddo
The comparison works for each field, but the fieldname itself is a blank after the first time. If I put an alert in for each field as it goes thru the loop, it does display the field, but in the code itself as it is going thru its a blank after the first one, not matter what I do. I have even added a delay, thinking its going to fast(?), but that did not help either.
Any thoughts??
Fred
Omniu
Earlier you suggested that we use the scatter before and after when a user is updating a master file to create a log file for changes.One part I cannot get to work, and its got me stumped.
//array1:=tractor->(scatter()) is loaded when record is opened. After the save, here is the code to update our log file
aArray2 := tractor->(Scatter())
nnn=1
do while nnn<=len(aArray1)
if aarray1[nnn]<>aarray2[nnn]
do uplog with "T",tractor->number,fieldname(nnn),aarray1[nnn],aarray2[nnn]
endif
nnn=nnn+1
enddo
The comparison works for each field, but the fieldname itself is a blank after the first time. If I put an alert in for each field as it goes thru the loop, it does display the field, but in the code itself as it is going thru its a blank after the first one, not matter what I do. I have even added a delay, thinking its going to fast(?), but that did not help either.
Any thoughts??
Fred
Omniu