Cannot get querying to work? [message #535820] |
Fri, 16 December 2011 08:31 ![Go to next message Go to next message](/forum/theme/orafaq/images/down.png) |
ericr
Messages: 22 Registered: January 2006
|
Junior Member |
|
|
I have a form that has a master detail section and the under that a multi record block for the children of that master item. What I am trying to accomplish is that when one of the children are highlighted and my "Drill Down" button is pressed the form is cleared, put into query mode, the child from the highlighted row gets put into the master section and the query executed.
Here is what I have so far (in a button pressed trigger):
DECLARE
-- variable to save selected child
v_cur_child varchar(50);
BEGIN
-- get the value for the item where cursor is
GO_RECORD(:SYSTEM.CURSOR_RECORD);
-- save value to variable
v_cur_wi_code := :BLOCK2.WI_CODE;
Clear_Form;
-- Go to the parent block
GO_BLOCK('BLOCK1');
-- Enter query mode
ENTER_QUERY;
-- set master record value to saved child value
:BLOCK1.WI_CODE := v_cur_child;
execute_query;
END;
BLOCK1 (master section) has query allowed = YES, insert and updated allowed = NO. The WI_CODE item within BLOCK1 has query allowed = YES, insert allowed = YES, and update allowed = NO.
The child section (BLOCK2) has query allowed = YES, insert and update allowed = NO. The WI_CODE item within BLOCK2 has query allowed = YES, insert allowed = YES, and update allowed = NO.
The problem is that no matter what I do the following 2 problems occur:
1. The saved value nevers get put into the master section. I know the value is being saved because I used MESSAGE to output for verification.
2. I keep getting the error: "FRM-41051: You cannot create records here."
Where have I gone wrong. The steps above seem logical to me. I have tried changing the order in which I do things but the result is the same.
Any ideas?
Thanks...
|
|
|
|
|
|
|
|
Re: Cannot get querying to work? [message #535849 is a reply to message #535846] |
Fri, 16 December 2011 10:42 ![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) |
cookiemonster
Messages: 13963 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
You could make it work with pre-query by storing the value in the button assigning it in pre-query if populated and then clearing it in post-query.
Littlefoot's way is better though. I keep forgetting about onetime_where.
|
|
|
|