Home » Developer & Programmer » Forms » iterate through text items
iterate through text items [message #81986] Mon, 07 April 2003 11:35 Go to next message
kim
Messages: 116
Registered: December 2001
Senior Member
is there any way to go easily loop through certain text items and see if each contains a particular value? i am trying to code a form that contains fields for numerical data entry. when data is entered the form will perform calculations, but if no data has been entered for some of the fields, the calculation will of course return null. since i don't want the user to have to enter zero for null fields, i need to programmatically define that if a field is null its value is zero. is there a way to do this for multiple fields at a time, instead of going the long way as in
if field1 is null then field1 = 0
if field2 is null then field2 = 0
...

thanks for any ideas you have!
Re: iterate through text items [message #81990 is a reply to message #81986] Tue, 08 April 2003 05:57 Go to previous message
JAFOD
Messages: 15
Registered: February 2003
Junior Member
If you want to store 0 in the database when the user leaves an item blank (or if these are non-database items, then you might be better off setting their REQUIRED property to YES and their DEFAULT VALUE to 0, then your computation would not have to account for NULLs, otherwise you can do your calculation like this:

v_total := NVL(field1,0) + NVL(field2,0) + NVL(field3,0);

and allow the actual item values to remain NULL if that is the way you want them stored in the table.
Previous Topic: OCI
Next Topic: Animate gif . Plese HELP!!!!
Goto Forum:
  


Current Time: Thu Apr 18 18:20:23 CDT 2024