Home » Developer & Programmer » Forms » when_validate_item trigger
when_validate_item trigger [message #147013] Tue, 15 November 2005 04:37 Go to next message
narendrakumarkm
Messages: 8
Registered: November 2005
Junior Member
I have query.

My form is of master detail.

The master block contains 2 textfields.The detail block contains 2 textfields.Before inserting values into the table, the two text field one in master block and one in detail block, combination must be checked.If user enters a value in text field in a detail block and once again user enters same value
for the next text item in detail block. The combination values are repeated now.A error must be raised.So before inserting I need to write WHEN_VALIDATE_ITEM trigger for this.

So i am stuck with this,so plz if you know this then let me know about it.
Re: when_validate_item trigger [message #147107 is a reply to message #147013] Tue, 15 November 2005 17:00 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Please give us a worked example as your explanation is not really clear.

I strongly suggest that the 'join' field in the detail block NOT be displayed on the canvas, which seems to be what you are doing. Default 'relations' behaviour will populate the detail 'join' field using the data from the master 'key' field.

To validate, the current wisdom is that you create a record group to hold the key values that exist in the database when you start the form (in When-New-Form-Instance) (search 'delete_group' and 'create_group'), then when a new record is added at the master level (in key field WVI) use an 'add' (you will see the command in the entries you have found) to keep the record group up-to-date, then in the WVI on the detail data field, loop through the record_group to see if the entry exists. IF you find it, then issue a 'message' followed by a 'raise form_trigger_failure'. Remember to code a 'delete' from the record group in the master key's Key-DELREC trigger.

David


David
Re: when_validate_item trigger [message #147169 is a reply to message #147107] Wed, 16 November 2005 00:58 Go to previous messageGo to next message
narendrakumarkm
Messages: 8
Registered: November 2005
Junior Member
HI,

Thanx for your suggestion. I will make u clear about this.

My frame is of tabular layout containing 10 records to be displayed.

If i enter a value in first record.And in the second record i enter same repeated value twice.

Then WHEN_VALIDATE_ITEM trigger must be raised before inserting the records into the database.Since already a value is entered in a record.

I am struck with this.

[Updated on: Wed, 16 November 2005 00:59]

Report message to a moderator

Re: when_validate_item trigger [message #147592 is a reply to message #147169] Fri, 18 November 2005 07:03 Go to previous messageGo to next message
m_Usuf
Messages: 21
Registered: November 2005
Location: Karachi Pakistan
Junior Member

Hi,

As a i understand that,
1. you dont want to enter duplicate record. am i right?
2. Whenever you entered record you want to check, Rgiht?
or
if something different then please explain us
If you would like to do something like that on When-validate-item then i try my best to help you.

Waiting your reply
Re: when_validate_item trigger [message #147594 is a reply to message #147169] Fri, 18 November 2005 07:07 Go to previous messageGo to next message
m_Usuf
Messages: 21
Registered: November 2005
Location: Karachi Pakistan
Junior Member

Hi,

As a i understand that,
1. you dont want to enter duplicate record. am i right?
2. Whenever you entered record you want to check, Rgiht?
or
if something different then please explain us
If you would like to do something like that on When-validate-item then i try my best to help you.

Waiting your reply
Re: when_validate_item trigger [message #147598 is a reply to message #147013] Fri, 18 November 2005 07:24 Go to previous messageGo to next message
ashishmate
Messages: 90
Registered: February 2005
Location: Mumbai
Member

hi


if you want to avoid user from inserting duplicate records tehn
you can use post or a record group.

Post you can use in when validate item ( by using timmer) and
every time user enter record fire select statement to check that record is present in table or not ..



for record group create record group from query at new from instance trigger

and in when validate record trigger use folloing code
(modify as per your need)


declare
gr_id  recordgroup := find_group('rg_test');
numr VARCHAR2(4000);
begin
rg_count := get_group_row_count(gr_id);

for  i in 1..rg_count loop   	
 numr := Get_Group_CHAR_Cell('rg_test.empno',i) ;
 if numr = :emp.empno||:emp.enAME||:emp.deptno then  
  p_message(' duplicate record ' );
  raise form_trigger_failure;	
 end if;
end loop;

add_group_row (gr_id,end_of_group );
rg_count := get_group_row_count(gr_id);
Set_Group_CHAR_Cell('rg_test.empno',rg_count,:emp.empno||:emp.enAME||:emp.deptno); 




Re: when_validate_item trigger [message #147753 is a reply to message #147598] Sun, 20 November 2005 21:39 Go to previous message
narendrakumarkm
Messages: 8
Registered: November 2005
Junior Member
Thanx very much 4 the help provided.

Previous Topic: install Forms server on windows XP
Next Topic: can i get the session information in the form.. urgently
Goto Forum:
  


Current Time: Fri Sep 20 03:28:19 CDT 2024