Multi record block [message #126604] |
Tue, 05 July 2005 21:23 |
rickyroma
Messages: 5 Registered: July 2005
|
Junior Member |
|
|
Hi, I have a forms challenge.
I am trying to populate a block with info that is not part of a master detail relationship.
The reason I am doing this is because I have to populate the block with info from 1 of 2 tables.
If the info I need on one table is not there then I want to populate the block with info from table 2. I seem to have a handle on that part but I cant get the block to display multi records for some reason. It gets an error. My question is how do I populate a multi record block thats not part of the master detail relationship? Thanks in advance for any suggestions you may offer.
|
|
|
Re: Multi record block [message #126632 is a reply to message #126604] |
Wed, 06 July 2005 01:08 |
kv_anitha
Messages: 3 Registered: July 2005 Location: Bangalore
|
Junior Member |
|
|
Hi,
try to use cursors.
Create a seperate block and say database block property - NO.
Then give the fetch sql's in cursor and populate the block.
hope your query is answered.
Please let me know if you need further clarrifications.
All the best
Regards
Ani
|
|
|
|
Re: Multi record block [message #126755 is a reply to message #126604] |
Wed, 06 July 2005 08:47 |
rickyroma
Messages: 5 Registered: July 2005
|
Junior Member |
|
|
Hi here is the script I put in a Post query trigger:
When it runs I get a message that says
Frm-40737: Ilegal restricted procedure Next_record in Post query trigger.
It still dispays only 1 record but doesnt display the other 4.
I have set up the block with a scroll bar and to display 2 records but it doesnt work.
Any other suggestions as to what I am doing wrong?
Thanks in advance.
declare depcnt number;
begin
select count(*)
into depcnt
from table_A
WHERE EMPLOYEE_ID = :PD_EMPLOYEE.EMPLOYEE_ID;
end;
DECLARE cursor c1 IS
SELECT EMPLOYEE_ID,
SURNAME,
FIRST_NAME,
RELATION_TO_EMPLOYEE_CODE
FROM table_A
WHERE EMPLOYEE_ID = :PD_EMPLOYEE.EMPLOYEE_ID;
cursor c2 IS
SELECT EMPLOYEE_ID,
SURNAME,
FIRST_NAME,
RELATION_TO_EMPLOYEE_CODE
FROM table_B
WHERE EMPLOYEE_ID = :PD_EMPLOYEE.EMPLOYEE_ID;
depcnt number;
begin
select count(*)
into depcnt
from table_A
WHERE EMPLOYEE_ID = :PD_EMPLOYEE.EMPLOYEE_ID;
if depcnt > 0 then
OPEN c1;
FIRST_RECORD;
LOOP
FETCH c1 into :dep.EMPLOYEE_ID,
:DEP.SURNAME,
:DEP.FIRST_NAME,
:DEP.RELATION_TO_EMPLOYEE_CODE;
EXIT WHEN c1%NOTFOUND;
NEXT_RECORD;
END LOOP;
CLOSE c1;
else
OPEN c2;
FIRST_RECORD;
LOOP
FETCH c2 into :dep.EMPLOYEE_ID,
:DEP.SURNAME,
:DEP.FIRST_NAME,
:DEP.RELATION_TO_EMPLOYEE_CODE;
EXIT WHEN c2%NOTFOUND;
NEXT_RECORD;
END LOOP;
CLOSE c2;
end if;
end;
|
|
|
Re: Multi record block [message #126842 is a reply to message #126755] |
Wed, 06 July 2005 22:51 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
I can't see any non-database information in your post-query.
Remember, the post-query fires for every record in the block and is for populating that record only.
If you have a master-detail defined you don't have to populate the lower block, forms does that for you.
Delete your trigger or rename it (for example, change hyphen '-' to underscore '_') and see what data appears. Then, and only then, put a post-query on the master block to get the extra 'master' record details and a post-query on the detail block to get the extra 'detail' record details.
David
|
|
|