Validating the Item [message #526224] |
Mon, 10 October 2011 04:33 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sivaora
Messages: 119 Registered: October 2009 Location: Hyderabad
|
Senior Member |
|
|
Hi All,
I created a block for EMP table on tabular style.
if in first line empno entered is 1
then i dont want to allow the end user to enter 1 in second line.
but when-validate-item is not working because first_record and next_record is not allowed.
i need to validate before saving the data into emp table and immediately after empno is entered into empno item.
Please help me on this...
|
|
|
Re: Validating the Item [message #526226 is a reply to message #526224] |
Mon, 10 October 2011 04:37 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Post the Data to the DB using the post builtin (when-new-record-instance is probably the best place for this). Then you can use a select statement in the WVI trigger to check if the user has already entered the value.
|
|
|
Re: Validating the Item [message #526228 is a reply to message #526226] |
Mon, 10 October 2011 04:44 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sivaora
Messages: 119 Registered: October 2009 Location: Hyderabad
|
Senior Member |
|
|
Thanks for your quick reply,
i used the Post built in already, It causes error because of my validation the total no of employees must be 10 before saving it to DB.
So i need to check for each line before storing the data into DB.
|
|
|
|
Re: Validating the Item [message #526232 is a reply to message #526229] |
Mon, 10 October 2011 04:56 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sivaora
Messages: 119 Registered: October 2009 Location: Hyderabad
|
Senior Member |
|
|
Hi,
Can you please tell me how to use Post with no commit.
My code is:
IF :SYSTEM.BLOCK_STATUS = 'CHANGED' THEN
POST;
END IF;
|
|
|
Re: Validating the Item [message #526237 is a reply to message #526232] |
Mon, 10 October 2011 05:06 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Post doesn't commit. That's kind of the point of it.
Your 10 emp restriction is going to be very hard to implement correctly. I wouldn't even try.
|
|
|
|
|
Re: Validating the Item [message #526245 is a reply to message #526241] |
Mon, 10 October 2011 05:31 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You don't understand the difference between post and commit obviously. Post does not commit. Ever. There's nothing to do to make it not commit.
Post - applies changes to the DB but does not issue a commit. So if the user decides not to save changes, those changes are rolled back.
|
|
|
Re: Validating the Item [message #526246 is a reply to message #526245] |
Mon, 10 October 2011 05:38 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
sivaora
Messages: 119 Registered: October 2009 Location: Hyderabad
|
Senior Member |
|
|
Post Doesn't commit the data which i knew already it's ok.
But if i apply post for the first record my validation fails as the no of employees should be 10. so i can't apply post here.
|
|
|
|
|
Re: Validating the Item [message #526263 is a reply to message #526261] |
Mon, 10 October 2011 06:32 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Trouble with that is that if the user enters some data, then clicks on the exit button, forms will ask them if they want to save changes. If they click yes, forms will write all data from the datablocks to the DB and commit it. Bypassing your code in the save button in the process.
|
|
|
|
|
|
Re: Validating the Item [message #526272 is a reply to message #526269] |
Mon, 10 October 2011 07:06 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
1) I don't believe any setting of system.message_level can supress the "do you want to save changes message"
2) LF - you miss the point. He's doing validation in a button, because he can't do it in validate triggers. But the button can be bypassed completely. You can't trap the "do you want to save" message.
3) I know of no way of reliably validating multiple records against each other in the same datablock in oracle forms (which is effectively what you are doing). I simply wouldn't try to implement this restriction.
If there really is an issue with entering too few records have a job or something monitor the number the of records and have that raise an alert or send an email or something if there aren't enough.
|
|
|