Dynamic addition of data on clicking of link in a pop-up

Description:This post displays about Dynamic addition of data on clicking of a link in a pop-up

Step:1:

On Click of tabular form column of parent report, execute below javascript code to open pop-up with the latest modification of parent report

 

 

 

Dynamic Action

Event : Onclick

Selection type : JQuery Selector

Execute Javascript Code,

var i = 1;

var a = “”;

var b = “”;

var c=  “”;

while (i != 0) {

b = “000” + i;

b = pad(i,4);

a = $(“#f10_” + b).val();

if (typeof a === “undefined”) {

i = 0;

} else {

if (a==’U’)

{

$(“#f11_” + b).val(“”);

//alert($(“#f02_” + b).val());

c=c+”^~”+$(“#f03_” + b).val()+”|~”+$(“#f05_” + b).val()+”|~”+$(“#f06_” + b).val()+’|~’+$(“#f07_” + b).val()+’|~’+$(“#P77_MASTER_PDVD_ID”).val();

}

i=i+1;

}

}

var get = new htmldb_Get(null,$x(‘pFlowId’).value,

‘APPLICATION_PROCESS=AP_REP_VAL’,0);

get.add(‘AI_UNIQ_VAL’,c);

gReturn = get.get();

x = gReturn.trim();

var id = event.target.id;

var bf_id = id.replace(“f11″,”f10”);

var dis = id.replace(“f11″,”f15”);

if ( $(“#”+dis).val() != “N” )

{

if ( $(“#”+bf_id).val()==’R’ )

{

$(“#P77_X”).val(id);

$(“#POPUP”).dialog({modal:true,resizable: false,height:400,width:650});

apex.jQuery(‘#POPUP’).trigger(‘apexrefresh’);

}

else

{

$(“#”+id).val(”);

}

}

 

 

Step:2: On click of report column call function in report attributes as  shown below,

 

 

 

 

 

 

function repli(a)

{

//alert (‘a:’+a);

var b=$(“#P77_X”).val();

//alert (‘b:’+b);

var get = new htmldb_Get(null,$x(‘pFlowId’).value,

‘APPLICATION_PROCESS=AP_TAB_FORM’,0);

get.add(‘AI_TAB_FORM’,a);

gReturn = get.get();

//alert (‘g:’+ gReturn);

x = gReturn.trim();

//alert (‘x:’+x);

$(“#”+b).val(x);

//  alert(b);

var rep = b.substring(4,8);

//alert(rep);

$(“#f17_”+rep).val(a);

$(“#POPUP”).dialog(“destroy”);

 

 

}

 

Application Process:

AP_REP_VAL

 

DECLARE

 

   lv_v_input     VARCHAR2 (32767);

 

   lv_v_row_val   VARCHAR2 (32767)                := ”;

 

   lv_v_sql       VARCHAR2 (32767)                := ”;

 

   l_vc_arr2      apex_application_global.vc_arr2;

 

BEGIN

 

   lv_v_input := :ai_uniq_val;

 

 

   BEGIN

 

      DELETE FROM pdvd_pt_rep_val_dtls;

 

 

      COMMIT;

 

   EXCEPTION

 

      WHEN OTHERS

 

      THEN

 

         raise_application_error (-20101,

 

                                     ‘Error in deleting replicate values’

 

                                  || SQLERRM

 

                                 );

 

   END;

 

 

   l_vc_arr2 := apex_util.string_to_table (lv_v_input, ‘^~’);

 

 

   FOR z IN 1 .. l_vc_arr2.COUNT

 

   LOOP

 

     — DBMS_OUTPUT.put_line (l_vc_arr2 (z));

 

      lv_v_row_val := REPLACE (l_vc_arr2 (z), ‘|~’, ”’,”’);

 

 

      BEGIN

 

         lv_v_sql :=

 

               ‘INSERT INTO PDVD_pt_rep_val_dtls(master_item_id,

 

                                                       program_name,

 

                                                       output_name,title,master_pdvd_id) VALUES (”’

 

            || lv_v_row_val

 

            || ”’)’;

 

 

         — DBMS_OUTPUT.put_line (lv_v_sql);

 

         EXECUTE IMMEDIATE lv_v_sql;

 

      EXCEPTION

 

         WHEN OTHERS

 

         THEN

 

            lv_v_sql := ”;

 

      END;

 

   END LOOP;

 

 

   COMMIT;

 

END;

 

 

 

Step:3: Set Tabular form attribute as Enable Page Partial Refresh to “Yes.”

 

Summary: This post explains about Global Alert Box in APEX

Queries?

Do drop a note by writing us at contact@staging.doyensys.com or use the comment section below to ask your questions.

 

 

 

Recent Posts