Solved

oracle forms question

Posted on 2013-02-06
11
428 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
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
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
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

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.

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…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.

803 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