Solved

oracle forms question

Posted on 2013-02-06
11
427 Views
Last Modified: 2013-02-11
Its about concatenating comments

If :parameter.EQUIP_USED_OTHERDRIVE = 'Y' then
      If :qc_equipment_used3.V_EQUIP_USED_COMMENTS is null then

        msgbox.show('Equip Used Note', 'Please enter comments '||chr(10)||' Why this    
           piece of Equipment is chosen that is being used on another drive.', 'OK');
           go_item('qc_equipment_used3.V_EQUIP_USED_COMMENTS');
            do_key('edit_textitem');
      Else
           GO_BLOCK('QC_PROCEDURES2');               
            EXECUTE_QUERY;
               :parameter.EQUIP_USED_OTHERDRIVE := 'N';
      End if;
Else      
          GO_BLOCK('QC_PROCEDURES2');               
            EXECUTE_QUERY;
End if;

----------------------

If :parameter.NON_ASSIGNED_EQUIP_CODE = 'Y' then
    If :qc_equipment_used3.comments is null then
      msgbox.show('Note', 'Please enter comments in order to pick this piece of    
           Equipment.', 'OK');

          go_item('qc_equipment_used3.comments');
          do_key('edit_textitem');                
     Else
           GO_BLOCK('QC_PROCEDURES2');               
            EXECUTE_QUERY;
           parameter.NON_ASSIGNED_EQUIP_CODE := 'N';
     End if;
 Else      
         GO_BLOCK('QC_PROCEDURES2');               
           EXECUTE_QUERY;
 End if;

-----------------------

:qc_equipment_used3.comments :=  
   replace(:qc_equipment_used3.comments,CHR(10),'')||chr(10)||
   replace(:qc_equipment_used3.v_equip_used_comments,CHR(10),'' );

This is how I concatenate the comments. But when I view it the result is like the one below

not from the departmentused on this drive too
used on this drive too

Not sure why used on this drive too is repeated. Any help is appreciated
0
Comment
Question by:anumoses
  • 6
  • 5
11 Comments
 
LVL 20

Expert Comment

by:flow01
Comment Utility
You probably enter the code 2x

I created simular behaviour in pl/sql

  1  declare
  2    c1  varchar2(255);
  3    c2  varchar2(255);
  4  begin
  5    c2 :=  'not from the department';
  6    c1 :=  'used on this drive too';
  7  for i1 in 1 .. 2 loop
  8   c2:=
  9  replace(c2,CHR(10),'')||chr(10)||
 10     replace(c1,CHR(10),'' );
 11  dbms_output.put_line(i1 || ' ********************************');
 12  dbms_output.put_line(c2);
 13  end loop ;
 14* end;
SQL> /
1 ********************************
not from the department
used on this drive too
2 ********************************
not from the departmentused on this drive too
used on this drive too

What trigger is this code in ?
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
there is a procedure and its a text item. Instead of a button I made this a text since we had to give different colors. Red when the procedure fails, green when its passes. So I created visual attributes. and visual attributes do not work on buttons. So this code is on when-mouse-click trigger
0
 
LVL 20

Accepted Solution

by:
flow01 earned 250 total points
Comment Utility
So you have a text item , simulating a button and when you click the item with the mouse
there is a when-mouse-click trigger

In the trigger you call a procedure that
-- concatenates the results of both comment fields in one of them
-- do some other things
-- and set the color of the text-item red or green at the end of the procedure or the trigger.

An easy way to get rid of the duplicate value is to empty  :qc_equipment_used3.v_equip_used_comments after you have concatenated it's value in
:qc_equipment_used3.comments, but I don't know if such behaviour is desired.

An other way is to create :qc_equipment_used3.concatenated_comment (or a variable within the procedure) and use this for further processing.

Be aware that each click wil execute the the code again and again.
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
If I want to create qc_equipment_used3.concatenated_comment when will I populate this in the query?
0
 
LVL 20

Expert Comment

by:flow01
Comment Utility
when validate item triggers of  both other comments

And
in my oracle forms 10  I can change the visual attribute of a push button .

      set_item_property('PUSH_BUTTON12',VISUAL_ATTRIBUTE,'VISUAL_ATTRIBUTE8');
and that works.
That  button does not contain an icon however.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 6

Author Comment

by:anumoses
Comment Utility
I have to use set_item_instance_property as its multi line block
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
I created a button and used the visual attribute. ON the when-button-pressed trigger I will add the code. Do you think this will fix the problem?
0
 
LVL 20

Expert Comment

by:flow01
Comment Utility
Not the problem you mentioned with 2x "used on this drive too" :
with this code hitting the button twice wil give you the same result

I checked: the visual attribute setting works also for the item_instance.
0
 
LVL 6

Author Comment

by:anumoses
Comment Utility
If I want to create qc_equipment_used3.concatenated_comment when will I populate this in the query?
0
 
LVL 20

Expert Comment

by:flow01
Comment Utility
It will probably not be a database-item so it has to be in the  post_query trigger.
0
 
LVL 6

Author Closing Comment

by:anumoses
Comment Utility
thanks
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

Article by: Swadhin
From the Oracle SQL Reference (http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm) we are told that a join is a query that combines rows from two or more tables, views, or materialized views. This article provides a glimps…
Working with Network Access Control Lists in Oracle 11g (part 2) Part 1: http://www.e-e.com/A_8429.html Previously, I introduced the basics of network ACL's including how to create, delete and modify entries to allow and deny access.  For many…
This video shows how to copy a database user from one database to another user DBMS_METADATA.  It also shows how to copy a user's permissions and discusses password hash differences between Oracle 10g and 11g.
Via a live example, show how to take different types of Oracle backups using RMAN.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now