dbTalk Databases Forums  

changevalue not triggering with table lookup

comp.databases.paradox comp.databases.paradox


Discuss changevalue not triggering with table lookup in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ryan Lindsey
 
Posts: n/a

Default changevalue not triggering with table lookup - 08-22-2008 , 11:29 AM






I am currently using Paradox 8.

I have a status field. Users can change this status via a table lookup
(ctrl+space).

My problem is that I want to add a log each time it's changed. My choice was
to put the code into the changeValue event but it seems the event does not
even get triggered when changing the value via ctrl+space. It will get
triggered if I actually type in the new status as long as I type something
that's in the lookup.

Am I just completely missing something? changevalue code is below but it is
never executed upon changing the field via the lookup.

method changeValue(var eventInfo ValueEvent)
var
strOldValue,
strNewValue String
endVar

strOldValue = self
doDefault
strNewValue = self

AddLog("Status changed from " + strOldValue + " to " + strNewValue)

endMethod



Reply With Quote
  #2  
Old   
Jim Giner
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 01:45 PM






You're not missing anything. It has to do with the table lookup I believe -
changevalue doesn't work the same way. What you have to do is trap in the
unlockrecord action and compare the 'new' value to the old value. basically,
read the underlying table before posting the new data.

Here's what I tried out - just a routine that demonstrates how you can see
the "prev." value before the update occurs at the record level, since you
can't capture it at the field level.


At the form level do this:
method action(var eventInfo ActionEvent)
var
oldname string
endvar
if eventInfo.isPreFilter() then
;// This code executes for each object on the form:

else
;// This code executes only for the form:
if eventinfo.id() = dataunlockrecord then
oldname = blank() ; init this fld
if tc.locate(1,name) then ; record key is called 'name'
view(tc.attributes,"Old") ; attributes is the fld I'm tracking
changes on - this displays the old value
oldname = name ; save the record key if we found a 'previous'
version
endif
dodefault ; this will do the posting
if oldname <> blank() then ; make sure I had a prev. record - if
blank then I didn't
if tc.locate(1,name) then ; re-locate the old record
view(tc.attributes,"new") ; display the newly posted value
endif
endif
endif
endif
endmethod

*****
Of course, there's probably some clever-er way of doing this, but I've not
found it.



Reply With Quote
  #3  
Old   
Jim Giner
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 01:45 PM



You're not missing anything. It has to do with the table lookup I believe -
changevalue doesn't work the same way. What you have to do is trap in the
unlockrecord action and compare the 'new' value to the old value. basically,
read the underlying table before posting the new data.

Here's what I tried out - just a routine that demonstrates how you can see
the "prev." value before the update occurs at the record level, since you
can't capture it at the field level.


At the form level do this:
method action(var eventInfo ActionEvent)
var
oldname string
endvar
if eventInfo.isPreFilter() then
;// This code executes for each object on the form:

else
;// This code executes only for the form:
if eventinfo.id() = dataunlockrecord then
oldname = blank() ; init this fld
if tc.locate(1,name) then ; record key is called 'name'
view(tc.attributes,"Old") ; attributes is the fld I'm tracking
changes on - this displays the old value
oldname = name ; save the record key if we found a 'previous'
version
endif
dodefault ; this will do the posting
if oldname <> blank() then ; make sure I had a prev. record - if
blank then I didn't
if tc.locate(1,name) then ; re-locate the old record
view(tc.attributes,"new") ; display the newly posted value
endif
endif
endif
endif
endmethod

*****
Of course, there's probably some clever-er way of doing this, but I've not
found it.



Reply With Quote
  #4  
Old   
Jim Giner
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 01:45 PM



You're not missing anything. It has to do with the table lookup I believe -
changevalue doesn't work the same way. What you have to do is trap in the
unlockrecord action and compare the 'new' value to the old value. basically,
read the underlying table before posting the new data.

Here's what I tried out - just a routine that demonstrates how you can see
the "prev." value before the update occurs at the record level, since you
can't capture it at the field level.


At the form level do this:
method action(var eventInfo ActionEvent)
var
oldname string
endvar
if eventInfo.isPreFilter() then
;// This code executes for each object on the form:

else
;// This code executes only for the form:
if eventinfo.id() = dataunlockrecord then
oldname = blank() ; init this fld
if tc.locate(1,name) then ; record key is called 'name'
view(tc.attributes,"Old") ; attributes is the fld I'm tracking
changes on - this displays the old value
oldname = name ; save the record key if we found a 'previous'
version
endif
dodefault ; this will do the posting
if oldname <> blank() then ; make sure I had a prev. record - if
blank then I didn't
if tc.locate(1,name) then ; re-locate the old record
view(tc.attributes,"new") ; display the newly posted value
endif
endif
endif
endif
endmethod

*****
Of course, there's probably some clever-er way of doing this, but I've not
found it.



Reply With Quote
  #5  
Old   
Jim Giner
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 01:45 PM



You're not missing anything. It has to do with the table lookup I believe -
changevalue doesn't work the same way. What you have to do is trap in the
unlockrecord action and compare the 'new' value to the old value. basically,
read the underlying table before posting the new data.

Here's what I tried out - just a routine that demonstrates how you can see
the "prev." value before the update occurs at the record level, since you
can't capture it at the field level.


At the form level do this:
method action(var eventInfo ActionEvent)
var
oldname string
endvar
if eventInfo.isPreFilter() then
;// This code executes for each object on the form:

else
;// This code executes only for the form:
if eventinfo.id() = dataunlockrecord then
oldname = blank() ; init this fld
if tc.locate(1,name) then ; record key is called 'name'
view(tc.attributes,"Old") ; attributes is the fld I'm tracking
changes on - this displays the old value
oldname = name ; save the record key if we found a 'previous'
version
endif
dodefault ; this will do the posting
if oldname <> blank() then ; make sure I had a prev. record - if
blank then I didn't
if tc.locate(1,name) then ; re-locate the old record
view(tc.attributes,"new") ; display the newly posted value
endif
endif
endif
endif
endmethod

*****
Of course, there's probably some clever-er way of doing this, but I've not
found it.



Reply With Quote
  #6  
Old   
Jim Giner
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 01:45 PM



You're not missing anything. It has to do with the table lookup I believe -
changevalue doesn't work the same way. What you have to do is trap in the
unlockrecord action and compare the 'new' value to the old value. basically,
read the underlying table before posting the new data.

Here's what I tried out - just a routine that demonstrates how you can see
the "prev." value before the update occurs at the record level, since you
can't capture it at the field level.


At the form level do this:
method action(var eventInfo ActionEvent)
var
oldname string
endvar
if eventInfo.isPreFilter() then
;// This code executes for each object on the form:

else
;// This code executes only for the form:
if eventinfo.id() = dataunlockrecord then
oldname = blank() ; init this fld
if tc.locate(1,name) then ; record key is called 'name'
view(tc.attributes,"Old") ; attributes is the fld I'm tracking
changes on - this displays the old value
oldname = name ; save the record key if we found a 'previous'
version
endif
dodefault ; this will do the posting
if oldname <> blank() then ; make sure I had a prev. record - if
blank then I didn't
if tc.locate(1,name) then ; re-locate the old record
view(tc.attributes,"new") ; display the newly posted value
endif
endif
endif
endif
endmethod

*****
Of course, there's probably some clever-er way of doing this, but I've not
found it.



Reply With Quote
  #7  
Old   
Jim Giner
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 01:45 PM



You're not missing anything. It has to do with the table lookup I believe -
changevalue doesn't work the same way. What you have to do is trap in the
unlockrecord action and compare the 'new' value to the old value. basically,
read the underlying table before posting the new data.

Here's what I tried out - just a routine that demonstrates how you can see
the "prev." value before the update occurs at the record level, since you
can't capture it at the field level.


At the form level do this:
method action(var eventInfo ActionEvent)
var
oldname string
endvar
if eventInfo.isPreFilter() then
;// This code executes for each object on the form:

else
;// This code executes only for the form:
if eventinfo.id() = dataunlockrecord then
oldname = blank() ; init this fld
if tc.locate(1,name) then ; record key is called 'name'
view(tc.attributes,"Old") ; attributes is the fld I'm tracking
changes on - this displays the old value
oldname = name ; save the record key if we found a 'previous'
version
endif
dodefault ; this will do the posting
if oldname <> blank() then ; make sure I had a prev. record - if
blank then I didn't
if tc.locate(1,name) then ; re-locate the old record
view(tc.attributes,"new") ; display the newly posted value
endif
endif
endif
endif
endmethod

*****
Of course, there's probably some clever-er way of doing this, but I've not
found it.



Reply With Quote
  #8  
Old   
Jim Giner
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 01:45 PM



You're not missing anything. It has to do with the table lookup I believe -
changevalue doesn't work the same way. What you have to do is trap in the
unlockrecord action and compare the 'new' value to the old value. basically,
read the underlying table before posting the new data.

Here's what I tried out - just a routine that demonstrates how you can see
the "prev." value before the update occurs at the record level, since you
can't capture it at the field level.


At the form level do this:
method action(var eventInfo ActionEvent)
var
oldname string
endvar
if eventInfo.isPreFilter() then
;// This code executes for each object on the form:

else
;// This code executes only for the form:
if eventinfo.id() = dataunlockrecord then
oldname = blank() ; init this fld
if tc.locate(1,name) then ; record key is called 'name'
view(tc.attributes,"Old") ; attributes is the fld I'm tracking
changes on - this displays the old value
oldname = name ; save the record key if we found a 'previous'
version
endif
dodefault ; this will do the posting
if oldname <> blank() then ; make sure I had a prev. record - if
blank then I didn't
if tc.locate(1,name) then ; re-locate the old record
view(tc.attributes,"new") ; display the newly posted value
endif
endif
endif
endif
endmethod

*****
Of course, there's probably some clever-er way of doing this, but I've not
found it.



Reply With Quote
  #9  
Old   
Jim Hargan
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 02:43 PM



Another way to approach this is to call a dialog form you design yourself,
rather than use the built-in lookup. You've already discovered one reason
to do this. Here's another, even better, reason: the path to the lookup
table is hard-coded in the table structure. If you ever change a directory
or drive, your table won't open. In Version 8, I've had this cause table
corruption and had to restore from a backup. (In later versions, moving
everything to the old locations worked, but not V8.)

--
Jim Hargan

-
On Fri, 22 Aug 2008 11:29:17 -0500, Ryan Lindsey wrote:

Quote:
I am currently using Paradox 8.

I have a status field. Users can change this status via a table lookup
(ctrl+space).

My problem is that I want to add a log each time it's changed. My choice was
to put the code into the changeValue event but it seems the event does not
even get triggered when changing the value via ctrl+space. It will get
triggered if I actually type in the new status as long as I type something
that's in the lookup.

Am I just completely missing something? changevalue code is below but it is
never executed upon changing the field via the lookup.

method changeValue(var eventInfo ValueEvent)
var
strOldValue,
strNewValue String
endVar

strOldValue = self
doDefault
strNewValue = self

AddLog("Status changed from " + strOldValue + " to " + strNewValue)

endMethod

Reply With Quote
  #10  
Old   
Jim Hargan
 
Posts: n/a

Default Re: changevalue not triggering with table lookup - 08-22-2008 , 02:43 PM



Another way to approach this is to call a dialog form you design yourself,
rather than use the built-in lookup. You've already discovered one reason
to do this. Here's another, even better, reason: the path to the lookup
table is hard-coded in the table structure. If you ever change a directory
or drive, your table won't open. In Version 8, I've had this cause table
corruption and had to restore from a backup. (In later versions, moving
everything to the old locations worked, but not V8.)

--
Jim Hargan

-
On Fri, 22 Aug 2008 11:29:17 -0500, Ryan Lindsey wrote:

Quote:
I am currently using Paradox 8.

I have a status field. Users can change this status via a table lookup
(ctrl+space).

My problem is that I want to add a log each time it's changed. My choice was
to put the code into the changeValue event but it seems the event does not
even get triggered when changing the value via ctrl+space. It will get
triggered if I actually type in the new status as long as I type something
that's in the lookup.

Am I just completely missing something? changevalue code is below but it is
never executed upon changing the field via the lookup.

method changeValue(var eventInfo ValueEvent)
var
strOldValue,
strNewValue String
endVar

strOldValue = self
doDefault
strNewValue = self

AddLog("Status changed from " + strOldValue + " to " + strNewValue)

endMethod

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.