Populating non-database item from record group ? [message #172620] |
Wed, 17 May 2006 06:45 |
pgroen
Messages: 4 Registered: May 2006
|
Junior Member |
|
|
This seems like a basic question, and I hope there is a basic answer
I have a database-item (GIZMO_ID) and a non-database item (GIZMO_NAME).
I also have an LOV and a record group to populate the GIZMO_ID / GIZMO_NAME when INSERTing or UPDATEing.
Furthermore I have a post-query trigger, to populate the GIZMO_NAME after a query.
Works like a charm...
My question is:
Can I avoid the redundancy in having essentially the same SELECT statement in the record group, as well as in the post-query trigger ?
Thanks in advance,
Peter
|
|
|
Re: Populating non-database item from record group ? [message #172683 is a reply to message #172620] |
Wed, 17 May 2006 11:26 |
vijaykkiran
Messages: 5 Registered: April 2006
|
Junior Member |
|
|
hi!
may this will help you to solve your problem,,do these actions...
When you inserting or updating the form will through an error, cathch this error my using the ON-ERROR trigger for the list item. and write the appropriate message.or you may want to write a code for populating the list elements after the query is ..
first find the record group..
if it is then, delete that and recrete that recordgroup and modify the select statement. then populate the list..
write the following code in the post-query
-------------------------------------------------
declare
rc recordgroup;
Rec_ID RecordGroup;
sts number;
begin
rc := find_group('MyRGP');
delete_group(rc);
Rec_ID := create_group_from_query('MyRGP','Select GIZMO_NAME,TO_CHAR'GIZMO_ID' FROm GIZMO_TABLE');
sts :=populate_group(RecID);
if sts <> 0 then
raise form_trigger_failure;
else
populate_list('MyList',RecID);
end if;
end;
-------------------------------------------
in the form-level or in the item level (i.e list item) ,,
ON-ERROR trigger write the code to handle the exception :
begin
if error_type='FRM' and error_code=41072 then
message(' Record Group Already Exists.. ');
message(' ');
end if;
end;
note: i dont know exactly the error code plz find out the error code on the bottom of the form ..ie.. form hint line area.. like this FRM-XXXXX : cann't create record group -- this message will display's..
------------------------------------------
|
|
|