Re: master query
"Tony Andrews" <[email protected]> Wed, 19 Mar 2003 12:46:55
| Newsgroups | gmane.comp.db.oracle.devel |
|---|---|
| Message-ID | <LYRIS-1796914-918576-2003.03.19-12.28.44--gcdod-oracle#[email protected]> |
You cannot do this directly - i.e. you cannot go to the detail block
without having any master selected, enter a query and retrieve matching
masters and details. You could do it by adding non-base table items
either in the master block or in a control block.
For example, suppose the form is based on DEPT (master) and EMP (detail).
You could have a control block before DEPT something like this:
-- Control BLock----------------------------
Deptno [ ] Dept Name [ ]
Empno [ ] Emp Name [ ]
Sal [ ]
[Execute Query]
--------------------------------------------
When the user has entered some criteria and pressed [Execute Query] then
you first modify the DEFAULT_WHERE clause of DEPT, then query DEPT and EMP.
For example:
IF :control.emp_name IS NOT NULL THEN
v_where := GET_BLOCK_PROPERTY( 'DEPT', DEFAULT_WHERE );
SET_BLOCK_PROPERTY( 'DEPT', DEFAULT_WHERE, v_where
||' AND EXISTS (SELECT 1 FROM emp WHERE emp.deptno = dept.deptno'
|| ' AND emp.ename = ''' || :control.emp_name||'''');
END IF;
...
GO_BLOCK('DEPT');
EXECUTE_QUERY;
---
Change your mail options at http://p2p.wrox.com/manager.asp or
to unsubscribe send a blank email to [email protected].