Home » Developer & Programmer » Forms » form
form [message #169513] Thu, 27 April 2006 06:17 Go to next message
orafan2003
Messages: 122
Registered: February 2006
Senior Member
Hi,
This is a simple employees block in my form. In the columm, commission_pct, I want to give a value of 0 to all the values that have NULL.
So I wrote when-validate-item at item level of commission_pct
IF :employees.commission_pct IS NULL THEN
:employees.commission_pct :=0;
end if;
But this is not working.
Should I write using set-item-property?
set_item_property(:commission_pct,0....)
Please guide me.
Thank you
Re: form [message #169583 is a reply to message #169513] Thu, 27 April 2006 11:59 Go to previous message
Littlefoot
Messages: 21818
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It seems that you'd like to set commission_pct to 0 for every record, one by one. As long as it looks OK when there are dozen employees, what will you do when there are thousands of them? Will you scroll through the form or do you have something else in mind?

Why don't you simply update those records through SQL*Plus and make sure that commission_pct can not be null for new records? Such as
UPDATE employees SET
commission_pct = 0
WHERE commission_pct IS NULL;

ALTER TABLE employees MODIFY commission_pct NOT NULL;
As of your form, it doesn't work because WHEN-VALIDATE-ITEM trigger is never fired UNLESS you type something into that field (even a space). Perhaps you'll be more satisfied with the same code, but in the POST-TEXT-ITEM trigger created on the ":employees.commission_pct" item? Or maybe PRE-RECORD trigger on "employees" block? Or, even better (to kill them all at once, using the POST-QUERY trigger on "employees" block? There are several possibilities, but updating records through SQL*Plus seems to be the most appropriate to me.
Previous Topic: Menu problem
Next Topic: Login
Goto Forum:
  


Current Time: Fri Sep 20 07:31:04 CDT 2024