NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: terryd on February 25, 2010, 01:34:10 AM
-
I would like to update other fields on a form based on a value entered in a field.
I have a field WEBPOL:InsuredValue in which I enter a value. [Image1.png]
On the Client Side Tab I tick the Send New value to server
In the server Code Button
I embed DO CalculatePremium !server side code
In ProcedureRoutines I have this code
CalculatePremium ROUTINE
IF WEBPOL:InsuredValue
WEBOPT:InsuredTo = WEBPOL:InsuredValue
ACCESS:WebOption.Open()
ACCESS:WebOption.Usefile()
SET(WEBOPT:SK_ToValue,WEBOPT:SK_ToValue)
NEXT(WebOption)
IF ERRORCODE()
p_web.SetSessionValue('WEBPOL:GrossPremium',0)
ELSE !Found record
WEBPOL:GrossPremium = WEBOPT:BasePremium
p_web.setSessionValue('WEBPOL:GrossPremium',WEBPOL:GrossPremium)
END
MESSAGE('WEBPOL:GrossPremium ' & WEBPOL:GrossPremium & ' WEBOPT:BasePremium ' & WEBOPT:BasePremium)
ACCESS:WebOption.Close()
END
Exit
The value of WEBPOL:GrossPremium is the same as the value of WEBOPT:BasePremium [Image2.png]
The field WEBPOL:GrossPremium is set as display on the tab but no value is displayed.
I have other fields which will also update in this procedure but I am sure the same principle will apply to them
P.S. The message command will be replaced by CapeSoftMessageBox before production.
Any help appreciated.
[attachment deleted by admin]
-
Are you refreshing the WEBPOL:GrossPremium and other fields on the Client side Tab?
-
I found that although the values didn't appear after entereing the InsuredValue they were there if I went back into the record.
Solution was to RESET the fields using the reset browse on the client side tab of POLWEB:InsuredValue
Thanks Kevin
-
All working great except this.
Problem with byte value set in dictionary as must be true or false
On the Client Side Tab I tick the Send New value to server
In the server Code Button
I embed DO CalculatePremium !server side code
In ProcedureRoutines I have this code
CalculatePremium ROUTINE
IF WEBPOL:Simsure <> 0
WEBPOL:SimsureFee = WEBOPT:Simsure
p_web.setSessionValue('WEBPOL:SimsureFee',WEBPOL:SimsureFee)
ELSE
WEBPOL:SimsureFee = 0
p_web.SetSessionValue('WEBPOL:SimsureFee',0)
END
Exit
WEBPOL:Simsure is a byte
I populate the field on the form as a checkbox.
The box is already checked at the point that the above code fires but the value of WEBPOL:Simsure is 0. If I look at the record in the database the value is 1.
Is there anything special about handling or accessing Byte fields?
Any help appreciated.
-
Hi Terry,
depending on where this is called from, WEBPOL:Simsure may not be set.
use p_web.GSV('WEBPOL:Simsure') instead.
cheers
Bruce