Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 12th, 2004, 07:04 AM
zishto zishto is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 zishto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
simple form, simple trigger, whats wrong ??

hi ...
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

begin
if : pay.hours_worked<40 then
: pay.gross=Houres_worked*hourly_rate;
end if;

if : pay.hours_worked>=40 then
: pay.gross=Houres_worked (hourly_rate*1.5);
end if;

if : pay.radio='member' then
: pay.fee= -20;
end if;

if : pay.radio='non' then
: pay.fee= 0;
end if;

if : pay.list='ohio' then
: pay.bonus=50;
else
: pay.bonus=100;
end if;

: pay.net=: pay.gross+: pay.fee+: pay.bonus;

end;

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

Reply With Quote
  #2  
Old January 12th, 2004, 08:07 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 6
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;

Here ,

a= 10
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.


Regards

Reply With Quote
  #3  
Old January 12th, 2004, 11:18 AM
zishto zishto is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 3 zishto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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 ...
Attached Files
File Type: zip payroll.zip (9.4 KB, 283 views)

Reply With Quote
  #4  
Old January 12th, 2004, 01:25 PM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 6
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.


Regards
Attached Files
File Type: zip payroll.zip (8.5 KB, 260 views)

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > simple form, simple trigger, whats wrong ??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT