Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 435
  • Last Modified:

oracle forms question

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
anumoses
Asked:
anumoses
  • 6
  • 5
1 Solution
 
flow01Commented:
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
 
anumosesAuthor Commented:
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
 
flow01Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
anumosesAuthor Commented:
If I want to create qc_equipment_used3.concatenated_comment when will I populate this in the query?
0
 
flow01Commented:
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
 
anumosesAuthor Commented:
I have to use set_item_instance_property as its multi line block
0
 
anumosesAuthor Commented:
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
 
flow01Commented:
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
 
anumosesAuthor Commented:
If I want to create qc_equipment_used3.concatenated_comment when will I populate this in the query?
0
 
flow01Commented:
It will probably not be a database-item so it has to be in the  post_query trigger.
0
 
anumosesAuthor Commented:
thanks
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

  • 6
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now