January 12th, 2004, 08:04 AM
simple form, simple trigger, whats wrong ??
i am new to oracle and PL/SQL ...
i have a problem in a form ...its a non database form which i created using developer 6i ...i have wrote the codes but its not running ... i am not really sure about the codes although its VERY SIMPLE ...
this is the code
if : pay.hours_worked<40 then
if : pay.hours_worked>=40 then
: pay.gross=Houres_worked (hourly_rate*1.5);
if : pay.radio='member' then
: pay.fee= -20;
if : pay.radio='non' then
: pay.fee= 0;
if : pay.list='ohio' then
: pay.net=: pay.gross+: pay.fee+: pay.bonus;
i am sure that the codes for the radio buttons and the list is wrong ... also i dont know what to chenge in the properties of the tools ...i only change that database items into No ...
please could anyone help me with this and tell me what is wrong ...
i have attached the form i created
January 12th, 2004, 09:07 AM
Try to use NVL function to calculate net payment, like that:
: pay.net= NVL(: pay.gross,0)+NVL(: pay.fee,0)+NVL(: pay.bonus,0);
The basic idea to use NVL function with numeric fields is, if numeric field does not contain any value then initialiaze it by 0. If you dont do it and try to use add, multiply, subtraction NULL with any value the result will be NULL. Let see the following example :
Total := a + b + c;
b = 40
c = null
what it should return? hmmm, you might think it should return you 50 but it will return NULL.
If this does not resolve your problem then let me know. how did you defined this procedure? I mean as a trigger in form, or as a program unit in form etc.
January 12th, 2004, 12:18 PM
hi dear shafique
thanx for ur replay ...i apreciate it ...
i have attached the form if you would like to check it for me ...
i have done all what u have mantioned but it still gives me error ...
January 12th, 2004, 02:25 PM
Ok, you need to define the initial value for the radio button, to do this double click on the RADIO item then select 'initial value' option under 'Data' node from its property pallete, and assign the value that should by either 'non' or 'member' (case restriction applied). Now pick up the one radio button 'NON' go to its property pallete, then select 'radio button value' option under the 'funtional' node, select another radio button 'MEMBER' goto its property and select 'radio button value' under 'functional node and aasign it to value 'member.
also you should use NVL function with the numeric fields whenever you are performing calculations.
I have also attached the modified for you to take a look.