validate data in details block before inserting into database [message #653233] |
Wed, 29 June 2016 13:47  |
 |
lucky123
Messages: 12 Registered: June 2016
|
Junior Member |
|
|
Is there a way to validate data before inserting into database in oracle forms??
Requirement is to not to allow to save the data if specific data for the item does not exist.
Ex: In the details block there is an item called name_code. user entered 4 records for that item name_code.
when the user click on save the record should get saved only if one of the 4 records has item_code value as 'OTHER'.
how can we achieve this requirement.Please suggest
|
|
|
Re: validate data in details block before inserting into database [message #653243 is a reply to message #653233] |
Thu, 30 June 2016 00:17   |
 |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
There are two basic triggers for validation: WHEN-VALIDATE-ITEM and WHEN-VALIDATE-RECORD. However, none of these can do what you are looking for as you want to validate the whole set of records. Therefore, you'll have to use a loop and navigate through all records in a form, searching for ITEM_CODE = 'OTHER'.
PRE-INSERT would be a good choice, only if it supported restricted built-ins (as you'd have to use NEXT_RECORD in the loop). However, as it does not, maybe KEY-COMMIT could be used instead. Unfortunately, you can avoid its execution; for example, if user wants to exit the form, he'll be asked if he wants to save the changes. If he says "Yes", records will be saved without KEY-COMMIT trigger being executed.
Hopefully, there are other options and someone will suggest them. I can't think of any currently ...
|
|
|
|
|
|
|
|
|