master-detail question [message #80956] |
Tue, 17 December 2002 12:40 |
sanjeev
Messages: 8 Registered: November 2000
|
Junior Member |
|
|
I have two tables, tab_a(master) and tab_b(detail)
they are one-to-one related.
In the form I want to create 2 blocks
blk_a and blk_b for each of the table above.
when I do execute_query. the data from tab_a and tab_b should both be displayed...
currently I tried creating master-detail relationship in form but it display the detail record only if I am in the master record. i.e it displays 10 master records
but only 1 detail(for current master), I wanted all the 10 details displayed too (for those 10 masters).
Any ideas?
Thanks
Sanjeev
|
|
|
Re: master-detail question [message #80961 is a reply to message #80956] |
Wed, 18 December 2002 02:22 |
Malcolm
Messages: 6 Registered: March 2002
|
Junior Member |
|
|
OK,
i have done something similar in the past...
the way i did it (though it isn't the only way) was to create the 2 blocks with NO relationship between them.
then on the POST-QUERY of the top block i concatonate all the key values into a string (i used a parameter "p_key_values" - formatting them into a nice comma seperated string; 'a', 'b', 'c'....) doing something like:
:PARAMETER.p_key_values := :PARAMETER.p_key_values||''''||:tab_a.key_index_field||''',';
then this string can be used to put into the DEFAULT_WHERE clause of the 2nd block by putting:
"WHERE tab_b.key_index_field IN (p_key_values)"
- Now when you perform the query on the second block - it will look at the default where and bring back the matching set to the top block...
- Notes:
* you need to remove the final comma from the key_string.
* you will need to perform all the queries programmatically - as there is no relationship between the block...
* you need to clear out this string after queries in order for a re-query to be correct.
- i hope this gives you a good start!
|
|
|
|