Home » Developer & Programmer » Forms » which Trigger??
which Trigger?? [message #641100] Mon, 10 August 2015 09:43 Go to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo

Once again, i would like to share my Problem here in the Forum, which help me really very good to improve my skill Smile

well, I have one master, and 2 Detail blocks.
and, i do have following query:

 select * from T1
   where exists ( select 1
                      from T2
                      where exists (select 1
                                       from T3, T2 where T2.id = T3.id and T2.text = T3.text ))
   and T1.kateg = 'TPD'
;

Now, when this condition match then, the block1.text should display text automatically in the block1.text and user just Need to give Input for other fields in the same block.
So, how could i can do this? or which Trigger and where should i use this?
please help.
thank you.
regards
Re: which Trigger?? [message #641102 is a reply to message #641100] Mon, 10 August 2015 10:13 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
You have an unecessary clause in your query that may degrade performance. This will be better:
select * from T1
   where exists ( select 1 from T3, T2 where T2.id = T3.id and T2.text = T3.text )
   and T1.kateg = 'TPD'
;
I know that this is not the question you have asked (I cannot answer that) but it is something you should fix.
Re: which Trigger?? [message #641103 is a reply to message #641100] Mon, 10 August 2015 10:13 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
That's actually really vague. Triggers are linked to actions performed in the screen. Your description doesn't really make clear what actions should cause this check to happen.
Re: which Trigger?? [message #641138 is a reply to message #641103] Tue, 11 August 2015 02:48 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo JW Thank you very much for your Feedback. I followed as per your comment Smile

Hallo CM,
Sry, for my unclear question. Actually, I do have master and 2 Detail blocks, and these detail blocks are activate and deactivate (for insert/update) as per if condition in WNRI in master block.
But, now, when both condition matched then, are both blocks are activate for insert/update, but in above block i can not display the respected data, that need to be display automatically and user are allowed to Input value for just one field.

I mean to say is: even if, the both condition matched but there are no value in the respective table fot that matched condition record then it should display other fields from the third table and user are allowed just to Input last value in the block.

As per attached fig1.: the case is, where the both blocks matched the condition and displayed data just in below block not in above blocks bcoz'there is no data for above block and in this case, the 4 fields should be display from Table3 and in the 5th field, user will insert new value and will saved in the respective table, i.e. table2.

Any idea or Suggestion please? Smile
Thanking you in advance.
regards,
  • Attachment: 2.JPG
    (Size: 42.68KB, Downloaded 828 times)
Re: which Trigger?? [message #641148 is a reply to message #641138] Tue, 11 August 2015 04:04 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
I have rewritten my query, which Returns those values which i do want to display in the block above when the condition matched.
SO, how and which Trigger should i apply to do this work?
declare
 var1  number;
begin
 select Count(*) into var1 from T1
    where T1.id not in ( select 1 from T2, T3 
                           where T2.id = T3.id and T2.cid = T3.cid )
 and T1.text ='TPD'
 and id = :control_blk.id;
 
 if var1 = 1 then
  select max(id), max(desp), max(Sub), max(det)
  into :blk1.id, blk1.desp, blk1.sub, blk1.det
  from T3 where exists (select 1 from T1 
                                 where T1.id = T3.id 
                                 and T1.cid = T3.cid 
                                 and T1.text in ('TPD')
  and id = :control_blk.id
end if;
end;

please any Suggestion or help?
thank you all
Re: which Trigger?? [message #641150 is a reply to message #641148] Tue, 11 August 2015 04:20 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Is there any reason not to do it in the existing WNRI?
Re: which Trigger?? [message #641151 is a reply to message #641150] Tue, 11 August 2015 04:24 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
DO you mean in control_blk or in Detail_blk?
i do have in both blocks WNRI, in control_blk check the condition and in Detail_blk, it does to make duplicate records and so ..
Re: which Trigger?? [message #641152 is a reply to message #641151] Tue, 11 August 2015 04:41 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
You need to think about this.
You want an operation to happen at a certain point. You know what that point is, we don't as your explanation is still vague on that point.
If it's when the user clicks into a particular record then use the appropriate WNRI
If it's when the user clicks into a particular record then use the appropriate WNBI
etc
Re: which Trigger?? [message #641159 is a reply to message #641152] Tue, 11 August 2015 05:59 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Thankx a lot CM for your great Support.
May be my case is bit complicated and i myself can not make u clear.. sry for that.
I think i Need to think the other way to do this...

Re: which Trigger?? [message #641170 is a reply to message #641159] Tue, 11 August 2015 08:05 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo again..

Well, I did now create new view instead of Table and used it in my forms, but now agian another Problem , we can not save new records in view, right?
If, I Need to insert/save new records then how can we do this?
Or is there any other Options to do so?

Regards,
Re: which Trigger?? [message #641171 is a reply to message #641170] Tue, 11 August 2015 08:13 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
You could base the block on a DB procedure
Re: which Trigger?? [message #641172 is a reply to message #641171] Tue, 11 August 2015 08:16 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
You mean Setting property of block as:
Query Data Source Type = Procedure
Query Data Source Name = View_name
I did so, but then i got the error while compiling and can not rum forms.

FRM-30432: Definition for procedure is not complete.
Block: RP_S_EMAIL
Procedure: RP_S_EMAIL_VIW
FRM-30085: Unable to adjust form for output.


Re: which Trigger?? [message #641174 is a reply to message #641172] Tue, 11 August 2015 08:31 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Switch your brain on please.
A view is not a procedure.
Telling oracle that view is a procedure is guaranteed to give an error.
You need to actually write a procedure.
Examples can be found online.
Re: which Trigger?? [message #641176 is a reply to message #641174] Tue, 11 August 2015 08:37 Go to previous message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
sry CM.... and thankx alot for your great Support n Feedback. Smile
Previous Topic: tab change
Next Topic: Add column to a existing form
Goto Forum:
  


Current Time: Fri Mar 29 08:12:49 CDT 2024