Problem working with Parent-Child Block [message #134650] |
Thu, 25 August 2005 23:53 |
yash1000
Messages: 22 Registered: August 2005
|
Junior Member |
|
|
Hi Guys,
I am having a problem working with Parent-Child relationship. I am using Oracle Form 4.5.
I am having two blocks say DEPT(parent) and EMP(Child). When the user click on DEPT.DEPTNO it populates child record. What I want to do is to add a bit of rule. i.e when the user click on DEPT.DEPTNO field and select value 10,it should disable all child records whose EMP.JOB='MANAGER'.
I would really appreciate any help on this.
Many thanks,
YASH
|
|
|
|
|
|
|
Re: Problem working with Parent-Child Block [message #134662 is a reply to message #134657] |
Fri, 26 August 2005 00:45 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
In the When-New-Record-Instance trigger on the EMP block, try testing the 'job' and if 'MANAGER' do a 'next-record'.
To be complete, you will have to know whether the user is going 'up' or 'down' and test if the current record to be 'jumped', if going 'up' is the next to first and if going down is the next to last.
David
Update: You can always program the 'Pre-Update' trigger to fail on 'MANAGER' records unless the user has a particular 'status'.
Sorry, I forgot that you have non-database blocks. Just do whatever processing you would do for a normal update and if it is a 'MANAGER' reject it. In the When-Validate-Item for each item, test the 'job' and do a raise form-trigger-failure when necessary.
[Updated on: Fri, 26 August 2005 01:11] Report message to a moderator
|
|
|
Re: Problem working with Parent-Child Block [message #134893 is a reply to message #134662] |
Sun, 28 August 2005 18:17 |
yash1000
Messages: 22 Registered: August 2005
|
Junior Member |
|
|
Hi David,
Thanks for giving me head on to my problem. Could you pls elborate more on your explanation as I could not figure out which built-in should I use in when-new-record-instance in order to disable the records whose job is manager.
Do not hestitate if you need any further clarification.
Thanks,
Yash
|
|
|
Re: Problem working with Parent-Child Block [message #134903 is a reply to message #134893] |
Sun, 28 August 2005 19:20 |
|
djmartin
Messages: 10181 Registered: March 2005 Location: Surges Bay TAS Australia
|
Senior Member Account Moderator |
|
|
Have you considered testing the status of the user in the where clause through which you are populating your block and if the user has access then show the 'MANAGER' records but if they don't have the correct status then don't put the 'MANAGER' records in your block?
In your 'UP' trigger put :global.direction := 'UP' (plus the UP command) and in your 'DOWN' trigger put :global.direction := 'DOWN'. Then in the When-New-Record-Instance havebegin
if :blk.position = 'MANAGER' then
If :global.direction = 'UP' then
if :system.cursor_record = 1 then
raise form_trigger_failure;
else
up;
end if;
else /* assume 'DOWN' */
if :system.last_record = 'TRUE' then
raise form_trigger_failure;
else
down;
end if;
end if;
end if;
end;
See if this works for you.
David
|
|
|