dbTalk Databases Forums  

changevalue and newvalue

comp.databases.paradox comp.databases.paradox


Discuss changevalue and newvalue in the comp.databases.paradox forum.



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

Default changevalue and newvalue - 06-07-2008 , 07:18 AM






Newvalue is triggered when a new value is entered into a field but is also
called on opening.
I have a rather large database which has similar fields (we will call them
ASA1 and ASA2) in separate, but linked tables. The fields are not identical
for good reasons which I will not discuss here.
However, when one of those fields changes, I want to take the value of the
field, perform an operation on the value and then put the new value in the
other field.
The code for that part is easy, but it runs upon opening as well as a
newvalue.
Changevalue doesn't seem to work all the time. It will work if move off the
field by hitting the tab or enter keys or use the mouse to touch another
field. This form is a notebook and if I click on the a new tab to look at
the other field, the other field has not changed.

Since CanDeaprt fires before changevalue, I tried putting self.postrecord()
in that but, it didn't seem to help. I am sure the Real Programmers out
there have dealt with this many times before and there is a relatively easy
answer.

As always,
Thanks for your help ahead of time.

Craig Futterman



Reply With Quote
  #2  
Old   
Jeff Shoaf
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:48 AM






ChangeValue() fires before the new value is applied to the field. If you
put DoDefault in the ChangeValue() event before you try to use the new
value, it will probably fix your issue.

Craig wrote:
Quote:
Newvalue is triggered when a new value is entered into a field but is also
called on opening.
I have a rather large database which has similar fields (we will call them
ASA1 and ASA2) in separate, but linked tables. The fields are not identical
for good reasons which I will not discuss here.
However, when one of those fields changes, I want to take the value of the
field, perform an operation on the value and then put the new value in the
other field.
The code for that part is easy, but it runs upon opening as well as a
newvalue.
Changevalue doesn't seem to work all the time. It will work if move off the
field by hitting the tab or enter keys or use the mouse to touch another
field. This form is a notebook and if I click on the a new tab to look at
the other field, the other field has not changed.

Since CanDeaprt fires before changevalue, I tried putting self.postrecord()
in that but, it didn't seem to help. I am sure the Real Programmers out
there have dealt with this many times before and there is a relatively easy
answer.

As always,
Thanks for your help ahead of time.

Craig Futterman



Reply With Quote
  #3  
Old   
Jeff Shoaf
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:48 AM



ChangeValue() fires before the new value is applied to the field. If you
put DoDefault in the ChangeValue() event before you try to use the new
value, it will probably fix your issue.

Craig wrote:
Quote:
Newvalue is triggered when a new value is entered into a field but is also
called on opening.
I have a rather large database which has similar fields (we will call them
ASA1 and ASA2) in separate, but linked tables. The fields are not identical
for good reasons which I will not discuss here.
However, when one of those fields changes, I want to take the value of the
field, perform an operation on the value and then put the new value in the
other field.
The code for that part is easy, but it runs upon opening as well as a
newvalue.
Changevalue doesn't seem to work all the time. It will work if move off the
field by hitting the tab or enter keys or use the mouse to touch another
field. This form is a notebook and if I click on the a new tab to look at
the other field, the other field has not changed.

Since CanDeaprt fires before changevalue, I tried putting self.postrecord()
in that but, it didn't seem to help. I am sure the Real Programmers out
there have dealt with this many times before and there is a relatively easy
answer.

As always,
Thanks for your help ahead of time.

Craig Futterman



Reply With Quote
  #4  
Old   
Jeff Shoaf
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:48 AM



ChangeValue() fires before the new value is applied to the field. If you
put DoDefault in the ChangeValue() event before you try to use the new
value, it will probably fix your issue.

Craig wrote:
Quote:
Newvalue is triggered when a new value is entered into a field but is also
called on opening.
I have a rather large database which has similar fields (we will call them
ASA1 and ASA2) in separate, but linked tables. The fields are not identical
for good reasons which I will not discuss here.
However, when one of those fields changes, I want to take the value of the
field, perform an operation on the value and then put the new value in the
other field.
The code for that part is easy, but it runs upon opening as well as a
newvalue.
Changevalue doesn't seem to work all the time. It will work if move off the
field by hitting the tab or enter keys or use the mouse to touch another
field. This form is a notebook and if I click on the a new tab to look at
the other field, the other field has not changed.

Since CanDeaprt fires before changevalue, I tried putting self.postrecord()
in that but, it didn't seem to help. I am sure the Real Programmers out
there have dealt with this many times before and there is a relatively easy
answer.

As always,
Thanks for your help ahead of time.

Craig Futterman



Reply With Quote
  #5  
Old   
Jeff Shoaf
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:48 AM



ChangeValue() fires before the new value is applied to the field. If you
put DoDefault in the ChangeValue() event before you try to use the new
value, it will probably fix your issue.

Craig wrote:
Quote:
Newvalue is triggered when a new value is entered into a field but is also
called on opening.
I have a rather large database which has similar fields (we will call them
ASA1 and ASA2) in separate, but linked tables. The fields are not identical
for good reasons which I will not discuss here.
However, when one of those fields changes, I want to take the value of the
field, perform an operation on the value and then put the new value in the
other field.
The code for that part is easy, but it runs upon opening as well as a
newvalue.
Changevalue doesn't seem to work all the time. It will work if move off the
field by hitting the tab or enter keys or use the mouse to touch another
field. This form is a notebook and if I click on the a new tab to look at
the other field, the other field has not changed.

Since CanDeaprt fires before changevalue, I tried putting self.postrecord()
in that but, it didn't seem to help. I am sure the Real Programmers out
there have dealt with this many times before and there is a relatively easy
answer.

As always,
Thanks for your help ahead of time.

Craig Futterman



Reply With Quote
  #6  
Old   
Jeff Shoaf
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:48 AM



ChangeValue() fires before the new value is applied to the field. If you
put DoDefault in the ChangeValue() event before you try to use the new
value, it will probably fix your issue.

Craig wrote:
Quote:
Newvalue is triggered when a new value is entered into a field but is also
called on opening.
I have a rather large database which has similar fields (we will call them
ASA1 and ASA2) in separate, but linked tables. The fields are not identical
for good reasons which I will not discuss here.
However, when one of those fields changes, I want to take the value of the
field, perform an operation on the value and then put the new value in the
other field.
The code for that part is easy, but it runs upon opening as well as a
newvalue.
Changevalue doesn't seem to work all the time. It will work if move off the
field by hitting the tab or enter keys or use the mouse to touch another
field. This form is a notebook and if I click on the a new tab to look at
the other field, the other field has not changed.

Since CanDeaprt fires before changevalue, I tried putting self.postrecord()
in that but, it didn't seem to help. I am sure the Real Programmers out
there have dealt with this many times before and there is a relatively easy
answer.

As always,
Thanks for your help ahead of time.

Craig Futterman



Reply With Quote
  #7  
Old   
Jeff Shoaf
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:48 AM



ChangeValue() fires before the new value is applied to the field. If you
put DoDefault in the ChangeValue() event before you try to use the new
value, it will probably fix your issue.

Craig wrote:
Quote:
Newvalue is triggered when a new value is entered into a field but is also
called on opening.
I have a rather large database which has similar fields (we will call them
ASA1 and ASA2) in separate, but linked tables. The fields are not identical
for good reasons which I will not discuss here.
However, when one of those fields changes, I want to take the value of the
field, perform an operation on the value and then put the new value in the
other field.
The code for that part is easy, but it runs upon opening as well as a
newvalue.
Changevalue doesn't seem to work all the time. It will work if move off the
field by hitting the tab or enter keys or use the mouse to touch another
field. This form is a notebook and if I click on the a new tab to look at
the other field, the other field has not changed.

Since CanDeaprt fires before changevalue, I tried putting self.postrecord()
in that but, it didn't seem to help. I am sure the Real Programmers out
there have dealt with this many times before and there is a relatively easy
answer.

As always,
Thanks for your help ahead of time.

Craig Futterman



Reply With Quote
  #8  
Old   
Jeff Shoaf
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:48 AM



ChangeValue() fires before the new value is applied to the field. If you
put DoDefault in the ChangeValue() event before you try to use the new
value, it will probably fix your issue.

Craig wrote:
Quote:
Newvalue is triggered when a new value is entered into a field but is also
called on opening.
I have a rather large database which has similar fields (we will call them
ASA1 and ASA2) in separate, but linked tables. The fields are not identical
for good reasons which I will not discuss here.
However, when one of those fields changes, I want to take the value of the
field, perform an operation on the value and then put the new value in the
other field.
The code for that part is easy, but it runs upon opening as well as a
newvalue.
Changevalue doesn't seem to work all the time. It will work if move off the
field by hitting the tab or enter keys or use the mouse to touch another
field. This form is a notebook and if I click on the a new tab to look at
the other field, the other field has not changed.

Since CanDeaprt fires before changevalue, I tried putting self.postrecord()
in that but, it didn't seem to help. I am sure the Real Programmers out
there have dealt with this many times before and there is a relatively easy
answer.

As always,
Thanks for your help ahead of time.

Craig Futterman



Reply With Quote
  #9  
Old   
Fred Z
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:56 AM



You could use the reason method with the following example taken
directly from Pdx help.

The following example assumes that a form contains a multi-record
object bound to the Orders table, and that the Ship_VIA field is a set
of radio buttons. Assume also that the form is in Edit mode. The
newValue method for Ship_VIA displays a message indicating why
newValue was called. When the form opens, the Reason will be
StartupValue.

; Ship_VIA::newValue
method newValue(var eventInfo Event)
; show why the newValue method was called
msgInfo("newValue reason",
iif(eventInfo.reason() = StartupValue, "StartupValue",
iif(eventInfo.reason() = FieldValue, "FieldValue", "EditValue")))
endMethod

When the user scrolls through the table or clicks the nextRec button,
the Reason will be FieldValue.

; nextRec:ushButton
method pushButton(var eventInfo Event)
action(DataNextRecord) ; this triggers a newValue for Ship_Via
; with a Reason constant FieldValue
endMethod

When the user chooses a different radio button on Ship_VIA or clicks
the changeRadio button, the Reason will be EditValue.

; changeRadio:ushButton
method pushButton(var eventInfo Event)
ORDERS.Ship_Via = "US Mail" ; this triggers a newValue for Ship_Via
; with a Reason of EditValue
endMethod

Or, if you want to test for the change in a tableframe try

method action(var eventInfo ActionEvent)
var
vActionID smallint
endvar

vActionID=eventinfo.id()

if vActionID=DataPostRecord or vActionID=DataUnlockRecord {plus maybe
a test to see if the record actually changed}
then
............your code here
endif

Good luck

Reply With Quote
  #10  
Old   
Fred Z
 
Posts: n/a

Default Re: changevalue and newvalue - 06-07-2008 , 09:56 AM



You could use the reason method with the following example taken
directly from Pdx help.

The following example assumes that a form contains a multi-record
object bound to the Orders table, and that the Ship_VIA field is a set
of radio buttons. Assume also that the form is in Edit mode. The
newValue method for Ship_VIA displays a message indicating why
newValue was called. When the form opens, the Reason will be
StartupValue.

; Ship_VIA::newValue
method newValue(var eventInfo Event)
; show why the newValue method was called
msgInfo("newValue reason",
iif(eventInfo.reason() = StartupValue, "StartupValue",
iif(eventInfo.reason() = FieldValue, "FieldValue", "EditValue")))
endMethod

When the user scrolls through the table or clicks the nextRec button,
the Reason will be FieldValue.

; nextRec:ushButton
method pushButton(var eventInfo Event)
action(DataNextRecord) ; this triggers a newValue for Ship_Via
; with a Reason constant FieldValue
endMethod

When the user chooses a different radio button on Ship_VIA or clicks
the changeRadio button, the Reason will be EditValue.

; changeRadio:ushButton
method pushButton(var eventInfo Event)
ORDERS.Ship_Via = "US Mail" ; this triggers a newValue for Ship_Via
; with a Reason of EditValue
endMethod

Or, if you want to test for the change in a tableframe try

method action(var eventInfo ActionEvent)
var
vActionID smallint
endvar

vActionID=eventinfo.id()

if vActionID=DataPostRecord or vActionID=DataUnlockRecord {plus maybe
a test to see if the record actually changed}
then
............your code here
endif

Good luck

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.