Master-Detail data displayed using LOV [message #496664] |
Tue, 01 March 2011 18:10 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](//www.gravatar.com/avatar/e873f7b4f44af7cbae65b5e273cf0c52?s=64&d=mm&r=g) |
Vachaun22
Messages: 10 Registered: March 2011
|
Junior Member |
|
|
I'm extremely new to Oracle all together. I'm working through Guide to Oracle 10g book and have run into a problem.
I have a master-detail form set up. I have an LOV set up on to be able to pick a record from the master table, but it doesn't automatically update the details data block.
What should I be looking for to do that? I thought that maybe I could just call the ON-POPULATE-DETAILS trigger, but apparently that can't be done.
Would it be possible to add a trigger to the field on post change to basically execute the same code in ON-POPULATE-DETAILS? That seems kind of odd to do that, but so far that's the only idea I can come up with at this point...
Suggestions as to what I'm missing? Thanks
|
|
|
|
Re: Master-Detail data displayed using LOV [message #496697 is a reply to message #496681] |
Wed, 02 March 2011 00:07 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
As far as I understood, this might be one way to do that:
- enter query mode in master block
- from LoV, choose a value
- execute query
If master-detail relationship is correctly set (wizard will do that for you, if you used it), both master and detail blocks will be populated with data. Of course, if there are no detail records for chosen master record, detail block will remain empty.
However, if querying is not what you are looking for, what do you do, then? Insert new records? If so:
- populate master block items (LoV or not, doesn't actually matter)
- go to detail block
- all items (that are used to maintain relationship) will also be populated in detail block. Some of them might be hidden, but they will also get their values.
If none of above, could you explain it once again, please?
|
|
|
|
Re: Master-Detail data displayed using LOV [message #496769 is a reply to message #496752] |
Wed, 02 March 2011 06:41 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
![](/forum/images/custom_avatars/72104.gif) |
Littlefoot
Messages: 21823 Registered: June 2005 Location: Croatia, Europe
|
Senior Member Account Moderator |
|
|
You have to follow steps I suggested; once again:
- in master block, enter query mode. If you don't do that (enter query mode) and select value from a LoV, it - actually - means that you are inserting a new master record.
- go to text item, open list of values, select one of values
- execute query
Option you mentioned (that uses GO_BLOCK and EXECUTE_QUERY) is used when "master" block is, actually, a control block (i.e. is not based on a table or a view). Then enter_query / execute_query won't work, so you have to explicitly go to detail block and execute query.
Note that - before you execute query - you have to specify which records to fetch. It can be done in PRE-QUERY trigger (block level), such as :detail_block.deptno := :control_block.deptno; -- the one you selected from an LoV or using SET_BLOCK_PROPERTY and specifying its ONETIME_WHERE clause.
As GO_BLOCK is a restricted procedure, you can't use it in all triggers. If your use a keyboard for navigation, KEY-NEXT-ITEM on LoV text item would do the job (it would fire when you select a value and press <Enter>):go_block('detail_block'); -- no square brackets! as in your example: '[block name]'
execute_query;
[Updated on: Wed, 02 March 2011 06:41] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
Re: Master-Detail data displayed using LOV [message #496985 is a reply to message #496876] |
Thu, 03 March 2011 08:36 ![Go to previous message Go to previous message](/forum/theme/orafaq/images/up.png) |
![](//www.gravatar.com/avatar/e873f7b4f44af7cbae65b5e273cf0c52?s=64&d=mm&r=g) |
Vachaun22
Messages: 10 Registered: March 2011
|
Junior Member |
|
|
Ah, sorry about the misunderstanding.
I don't work at the University, I'm attending classes there. We don't use Oracle where I work, we use other SQL servers. I only took this class so I had an opportunity to work with Oracle some.
|
|
|