Solved

oracle forms question

Posted on 2013-02-06
11
432 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 20

Expert Comment

by:flow01
ID: 38860049
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
ID: 38860072
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
ID: 38860504
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Author Comment

by:anumoses
ID: 38860633
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
ID: 38861018
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
 
LVL 6

Author Comment

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

Author Comment

by:anumoses
ID: 38861329
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
ID: 38861520
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
ID: 38861528
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
ID: 38861631
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
ID: 38876001
thanks
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Working with Network Access Control Lists in Oracle 11g (part 1) Part 2: http://www.e-e.com/A_9074.html So, you upgraded to a shiny new 11g database and all of a sudden every program that used UTL_MAIL, UTL_SMTP, UTL_TCP, UTL_HTTP or any oth…
How to Create User-Defined Aggregates in Oracle Before we begin creating these things, what are user-defined aggregates?  They are a feature introduced in Oracle 9i that allows a developer to create his or her own functions like "SUM", "AVG", and…
This video shows syntax for various backup options while discussing how the different basic backup types work.  It explains how to take full backups, incremental level 0 backups, incremental level 1 backups in both differential and cumulative mode a…
This video shows how to recover a database from a user managed backup
Suggested Courses

622 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