Home » Developer & Programmer » Forms » Validating records in a Control block sequentially
Validating records in a Control block sequentially [message #119508] Thu, 12 May 2005 23:17 Go to next message
vgs2005
Messages: 123
Registered: April 2005
Senior Member
I have a control block that has 10 records in it. How do I write a trigger to validate all records when I click on the 'Exit' button. I mean, how do I traverse each row? I'm having trouble using navigational triggers..
thanks in advance..
Re: Validating records in a Control block sequentially [message #119509 is a reply to message #119508] Thu, 12 May 2005 23:41 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Long answer:
Use block properties to determine the last row.

Build a row loop starting from row one to row 'n'.

Inside this loop use record and item properties to determine first field and last field and use them to control a second loop.

Assuming you have no manual navigation coded, you can traverse the block row by row, and then field by field running your manual validations as you go.

Short answer:
Base your block on a 'real' table using the standard validation and they will fire automatically as the user enters the data and leaves the field.

David
Re: Validating records in a Control block sequentially [message #119624 is a reply to message #119508] Fri, 13 May 2005 09:42 Go to previous messageGo to next message
oralover
Messages: 97
Registered: January 2005
Member
use code like this...

Declare
  total_records number:=0;
Begin
  go_block('YOUR_MULTI_RECORD_BLOCK');
  Last_Record;
  total_records := to_number(:system.cursor_record);
  First_Record;
  For i in 1..total_records;
  Loop
      here goes your validation code...
      If condition not true Then
         Next_Record;
      End If;
  End Loop;
End;

If you want to track from which record validation begin, simple add a variable after total_records as:

  curr_record number:=to_number(:system.cursor_record);

i also faced problems with Navigational Triggers for this kind of validation. If somebody else has better idea, please inform.

we have to remember one thing that there is no limit of knowledge and ideas.

Re: Validating records in a Control block sequentially [message #122313 is a reply to message #119624] Sun, 05 June 2005 20:50 Go to previous message
lomhanz
Messages: 18
Registered: May 2005
Location: Cebu, Philippines
Junior Member

Declare
total_records number:=0;
Begin
go_block('YOUR_MULTI_RECORD_BLOCK');
Last_Record;
total_records := to_number(:system.cursor_record);
First_Record;
For i in 1..total_records;
Loop
here goes your validation code...
If condition not true Then
Next_Record;
End If;
End Loop;
End;

== script with same result as above ==
declare
begin
go_block('YOUR_MULTI_RECORD_BLOCK');
first_record;
loop
<condition...>
if :system.last_record='TRUE' then exit; end if;
next_record;
end loop;
end;
Previous Topic: Failed to publish the application WTG-03010: the application already exists
Next Topic: How to display backend messages in forms?
Goto Forum:
  


Current Time: Thu Sep 19 18:51:00 CDT 2024