>Was stuck for a bit on finding the number of fields in the table without hardcoding it. Ended up with
>
>mnTotFields=Len(SUBSTR(GETFLDSTATE(-1,"Students"),2))
Hmm, why not use 'FCOUNT()' function?
>FOR mnHitPoint=1 to mnTotFields &&Check Each Field
> SELECT students
> fieldname=field(mnHitPoint)
> IF &fieldname==OLDVAL(FIELD(mnHitPoint)) &&This user hasn't changed it
Use 'evaluate()' function instead of '&', it is twise more quick. For example:
mnTotFields = FCOUNT("students")
FOR mnHitPoint=1 to mnTotFields
fieldname = field(mnHitPoint,"students")
fvalue = evaluate("students."+fieldname)
if vartype(fvalue) == 'G'
loop
endif
foldvalue = OLDVAL(fieldname)
IF !(IsNull(fvalue) AND !IsNull(foldvalue) OR ;
!IsNull(fvalue) and IsNull(foldvalue) ) AND ;
fvalue == foldvalue
....
endif
endfor
The most quick way, however, is put fields list into array (afields function) and put buffered field values into array ('copy to array'). Buth above way will work fine too even for large tables with many fields.
>And so on! I have a customer that will be very happy.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.