Home » Developer & Programmer » Forms » master-Detail n others
master-Detail n others [message #639229] Fri, 03 July 2015 03:58 Go to next message
sanodani
Messages: 98
Registered: October 2014
Member
Hallo..

I am trying to solve following Problem but i not getting it Sad
Can anyone please help me or give me Suggestion, how i can do it?

Well, my Problem is:

I do have Master-Detail block, and
Master Block:
rp_id,
Person

Detail Block:
field
Description
Subject
Email

and i do have 3 tables,
table 1:
rp id, person

table2
rp_id, field, description, subject

table3
rp_id, creiteria

and i am trying to do that, when rp_id = test1 then it will Display the following Detail field automatically that belongs to this rp_id. and also it should check table3.creiteria='email'

I would be very grateful for your valuable Suggestion n help

thankx

regards,
Re: master-Detail n others [message #639230 is a reply to message #639229] Fri, 03 July 2015 04:05 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Quote:

when rp_id = test1 then it will Display the following Detail field automatically

If you created true master-detail relationship (not just because you call it "master - detail", but - there are triggers and procedures that maintain that relationship) between those two data blocks (you should have used Data Block Wizard; it does it for you), then you don't have to do anything - Forms will do that automatically.

Quote:

it should check table3.creiteria='email'

What does it mean? What should happen if table3.creiteria = 'email' for that RP_ID?
Re: master-Detail n others [message #639231 is a reply to message #639230] Fri, 03 July 2015 04:19 Go to previous messageGo to next message
sanodani
Messages: 98
Registered: October 2014
Member
Hallo Litlefoot..

thankx for your prompt reply.. Smile

well i do follow the data block wizard but it Shows all the records belongs to this rp_id, but i would like to have those records where creiteria = email

I tried with the post_query in Detail block but getting error
"FRM-40735: POST-QUERY Trigger raised unhandled exception ORA-01422"
my code is:
select a.field, a.description, a.subject
   into :d_block.field, :d_block.description, :d_blcok.subject
  from table1 a, table2 b, table3 c
  where a.rp_id = b.rp_id
  and c.creiteria ='email';


Re: master-Detail n others [message #639232 is a reply to message #639231] Fri, 03 July 2015 04:31 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Aha, so that's yet another WHERE condition. Put it into WHERE property of the detail block, something like
where rp_id in (select t3.rp_id from table3 t3
                      where t3.creiteria = 'email')
Re: master-Detail n others [message #639238 is a reply to message #639232] Fri, 03 July 2015 05:42 Go to previous messageGo to next message
sanodani
Messages: 98
Registered: October 2014
Member
Hallo Litlefoot..
thankx once again..
well, I am still getting the same Problem...
can you please help me?

here is my actual code:

select a.field, a. descp, a. subject, c. email, d.line
into :d_blcok1.field,
     :d_blcok1.descp,
     :d_blcok1.subject,
     :d_block2.email
     :d_block3.line
from table1 a, table2, b, table3 c, table4 d
where a.rp_id in ( select b.rp_id from table2 b where b.criteria = 'email')
and a.rp_id = c.rp_id
and a.rp_id = d.rp_id;

Thanking you.



Re: master-Detail n others [message #639239 is a reply to message #639238] Fri, 03 July 2015 05:48 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This is the POST-QUERY trigger, right? If so, you don't need it, it won't do what you are looking for. POST-QUERY is to be used when you are populating some non-database items after the query has been executed, but you don't have such items here, do you?

You want to restrict records which are retrieved into the form when you execute query. Therefore, you have to modify data block's WHERE clause property - open block's Property Palette window and you'll find it in there, under the "Database" node.

I think I made a mistake in my previous message, saying that you should modify DETAIL block's WHERE clause - nope, that would be MASTER block instead.
Re: master-Detail n others [message #639241 is a reply to message #639239] Fri, 03 July 2015 06:05 Go to previous messageGo to next message
sanodani
Messages: 98
Registered: October 2014
Member
no sorry litttlefoot... Sad it did not work.. as i wrote where clause in master block...

Sad
can you please give me still some other solution? :/

thanking you alot
Re: master-Detail n others [message #639242 is a reply to message #639241] Fri, 03 July 2015 06:09 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What exactly did you put into master block's WHERE clause? Could you post it?
Re: master-Detail n others [message #639243 is a reply to message #639242] Fri, 03 July 2015 06:10 Go to previous messageGo to next message
sanodani
Messages: 98
Registered: October 2014
Member
rp_id in(select rp_id from table3 where creiteria = 'email')
Re: master-Detail n others [message #639245 is a reply to message #639243] Fri, 03 July 2015 06:15 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
That seems to be OK.

What does then "it did not work" mean? The above WHERE clause should make sure that TABLE1 records - whose RP_ID contains 'email' in TABLE3.CREITERIA column - are displayed. This is similar to pure SQL SELECT statement. Please, run it in SQL*Plus and copy/paste its output over here:
select t1.*
from table1 t1
where t1.rp_id in (select t3.rp_id from table3 t3
                   where t3.creiteria = 'email'
                  );
Re: master-Detail n others [message #639246 is a reply to message #639245] Fri, 03 July 2015 06:37 Go to previous messageGo to next message
sanodani
Messages: 98
Registered: October 2014
Member
hi littlefoot Smile
can i send u my file as per mail?
Re: master-Detail n others [message #639247 is a reply to message #639246] Fri, 03 July 2015 06:47 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What file? A FMB? No, there's no use, I don't have your tables nor data so I can't run it anyway. Besides, you didn't mention which Forms version you use.

Moreover, what's the result of a query I wrote previously?
Re: master-Detail n others [message #639248 is a reply to message #639247] Fri, 03 July 2015 07:01 Go to previous messageGo to next message
sanodani
Messages: 98
Registered: October 2014
Member
ok Sad

ya i tried it in my actual table but i still get more record then it actually have.
i see there is just 3 records in t3 but it gives me 15 recs back, it also gives the other record where criteria != email

actually, i m using Oracle form Version 10.


Re: master-Detail n others [message #639249 is a reply to message #639248] Fri, 03 July 2015 07:03 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Saying that "it doesn't work as expected" means nothing. I have no idea why you got 15 records instead of 3 of them. If you could provide test case (CREATE TABLE and INSERT INTO sample data), we could try it ourselves.
Re: master-Detail n others [message #639251 is a reply to message #639249] Fri, 03 July 2015 07:06 Go to previous message
sanodani
Messages: 98
Registered: October 2014
Member
ok,, i will try to Show you Mr littlefoot...
but anyway i thank you very much for your Kind help and Suggestion Smile

Best Regards,
Previous Topic: Form not populating data without pressing F8
Next Topic: Oracle Function Median
Goto Forum:
  


Current Time: Fri Apr 19 11:48:39 CDT 2024