I cannot workout how to validate a condition. The fragment of script I have been playing with is below. |Basically I want to reroute the script if and only if the fiend 'discontinu' is .t.
This is a further step from Peter Wayne's audit trail.
dim f_val as c
dim init_val as c
dim activity as c
dim audit as p
dim detail as p
dim fld as p
dim i as n
dim mode as n
dim nflds as n
dim nallceflds as n
dim non_status_change as l
dim allce as p
allce=table.get("allowanc")
nallceflds=allce.fields_get()
audit=table.open("Allowanc_Audit")
audit.enter_begin()
'debug(1)
non_status_change=.f.
mode=allce.mode_get()
'ui_msg_box("Mode","Mode is "+allce.mode_get())
'mode of '1' is a change, and '2' is a new entry
activity=""
audit.date=date()
audit.time=time()
audit.idnum=allce.idnum
audit.Identity=allce.name+allce.inits
if mode=1 then
for i=1 to nallceflds
fld=allce.field_get(i)
if fld.name_get()"Status" then
f_val=fld.value_get()
init_val=fld.initial_value_get()
trace.writeln(fld.name_get()+" "+f_val)
'ui_msg_box("Initial Value",init_val)
if f_valinit_val then
non_status_change=.t.
'debug(1)
'ui_msg_box("Changed to",f_val)
activity=activity+fld.name_get()+" was changed from "+trim(init_val) + " to " +trim(f_val)+crlf()
end if
end if
next
if fld.name_get()="discontinu" then
if f_val=".t." then
ui_msg_box("Check",f_val)
audit.Entry_type="CLOSED"
end if
END if
audit.Entry_type="CHANGE"
audit.Activity=activity
If anyone can see what i am doing wrong - I am sure it is something to do with how I am trying to call up a field and look at its contents. I have always found this syntax difficult.
This is a further step from Peter Wayne's audit trail.
dim f_val as c
dim init_val as c
dim activity as c
dim audit as p
dim detail as p
dim fld as p
dim i as n
dim mode as n
dim nflds as n
dim nallceflds as n
dim non_status_change as l
dim allce as p
allce=table.get("allowanc")
nallceflds=allce.fields_get()
audit=table.open("Allowanc_Audit")
audit.enter_begin()
'debug(1)
non_status_change=.f.
mode=allce.mode_get()
'ui_msg_box("Mode","Mode is "+allce.mode_get())
'mode of '1' is a change, and '2' is a new entry
activity=""
audit.date=date()
audit.time=time()
audit.idnum=allce.idnum
audit.Identity=allce.name+allce.inits
if mode=1 then
for i=1 to nallceflds
fld=allce.field_get(i)
if fld.name_get()"Status" then
f_val=fld.value_get()
init_val=fld.initial_value_get()
trace.writeln(fld.name_get()+" "+f_val)
'ui_msg_box("Initial Value",init_val)
if f_valinit_val then
non_status_change=.t.
'debug(1)
'ui_msg_box("Changed to",f_val)
activity=activity+fld.name_get()+" was changed from "+trim(init_val) + " to " +trim(f_val)+crlf()
end if
end if
next
if fld.name_get()="discontinu" then
if f_val=".t." then
ui_msg_box("Check",f_val)
audit.Entry_type="CLOSED"
end if
END if
audit.Entry_type="CHANGE"
audit.Activity=activity
If anyone can see what i am doing wrong - I am sure it is something to do with how I am trying to call up a field and look at its contents. I have always found this syntax difficult.
Comment