To implement a Row–LOV, create an LOV that selects the primary key
of the row the user wants into a form parameter, and then copy that
value into the primary key field in the results block right before
executing a query.
This example uses the DEPT block, which is based on the DEPT table,
and consists of the three columns DEPTNO, DNAME and LOC. This
table contains a row for each department in a company.
Create a Parameter for Your Primary Key
Create a form parameter(s) to hold the primary key(s) for the LOV. If
the Row–LOV is for a detail block, you do not need a parameter for the
foreign key to the master block (the join column(s)), as you should
include that column in the WHERE clause of your record group in a
later step. Set the datatype and length appropriately.
For example, for the DEPT block, create a parameter called
DEPTNO_QF.
Create an LOV
Create an LOV that includes the columns your user needs to identify
the desired row. If the Row–LOV is for a detail block, you should
include the foreign key to the master block (the join column(s)) in the
WHERE clause of your record group. Return the primary key for the
row into the parameter.
For our example, create an LOV, DEPT_QF, that contains the columns
DEPTNO and DNAME. Set the return item for DEPTNO into
parameter DEPTNO_QF. Although the user sees DNAME , it is not
returned into any field.
Create a PRE–QUERY Trigger
Create a block–level PRE–QUERY trigger (Execution Hierarchy: Before)
that contains:
IF :parameter.G_query_find = ’TRUE’ THEN
:= :parameter.;
:parameter.G_query_find := ’FALSE’;
END IF;
For multi–part keys, you need multiple assignments for the primary
key.
The parameter G_query_find exists in the TEMPLATE form.
For the Dept example, your PRE–QUERY trigger contains:
IF :parameter.G_query_find = ’TRUE’ THEN
:DEPT.DEPTNO := :parameter.DEPTNO_QF
:parameter.G_query_find := ’FALSE’;
END IF;
Create a QUERY_FIND Trigger
Finally, create a block–level user–named trigger QUERY_FIND on the
results block (Execution Hierarchy: Override) that contains:
APP_FIND.QUERY_FIND(’’);
For DEPT:
APP_FIND.QUERY_FIND(’DEPT_QF’);
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/77580/viewspace-212802/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/77580/viewspace-212802/