Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: newbie forms question.
bubba wrote:
>
> I have a simple form setup that displays customer records.
>
> How can I pre-fetch the records without having to enter a query in oracle
> forms runtime?
>
> In other words, can i programmatically pre-load the form so that it gets the
> records i want it to when it loads up? This way I can avoid having to teach
> my users how to use oracle runtime queries.
>
> any code examples would be greatly appreciated.
You can execute the query programmatically in the WHEN-NEW-FORM-INSTANCE (if I remember well...) trigger.
To do this, in that trigger:
IF :SYSTEM.CURSOR_BLOCK != 'block_table_with_qry_to_execute' THEN GO_BLOCK('block_table_with_qry_to_execute'); EXECUTE_QUERY; END IF;
If you have to 'filter' data with particular where conditions, I suggest to use parameters in the block 'WHERE Clause' property and to set them before the previous statements.
In this case:
suppose you have to execute the query to find all records in which the field SURNAME has a certain value.
SURNAME = :PARAMETER.SUR 3a) You can pass a parameter 'SUR' when you call your form with runform or from another form with open_form or call_form
pl_id := Get_Parameter_List('THE_LIST_NAME'); if not id_null(pl_id) then Destroy_Parameter_List(pl_id); end if; pl_id := Create_Parameter_List('THE_LIST_NAME'); Add_Parameter(pl_id, 'SUR', TEXT_PARAMETER, 'Smiths'); Open_Form('form_with_query_to_call', NO_HIDE, NO_REPLACE,NO_QUERY_ONLY, pl_id);
And in the WHEN-NEW-FORM-INSTANCE of the called form 'form_with_query_to_call' write the previous statement;
3b) Instead, if you use directly the form 'form_with_query_to_call', you can simply assign the default value 'Smiths' to the 'SUR' parameter and use the same WHEN-NEW-FORM-INSTANCE trigger.
My bad english causes it to appear more difficult, I'm sorry...
Write me (Marco.Landi_at_softeco.it) if you need more help. Bye,
Marco. Received on Fri Jun 04 1999 - 04:47:43 CDT