APEX

Conditional Alert / Comments on Hover

Conditional Alert / Comments on Hover is common requirement, In Old days, it is common to use drill-down pop-up user has to click and view comments and after that he has to close it. If he had 100 records it takes time to click and check on it. Instead of Click, It is better to visualize comments / alert on hover. Step:1: In Link / Element Attributes, we can call function on mouse hover using javascript as follows: onmouseover=”fun_status(#DELIVERY_ITEM_ID#,#DELIVERY_PDVD_ID#);” Step:2: In function we will check our condition and display it conditionally. It is simple, But we used it for field locks as user can be restricted to click on link when other user is using it , during hover itself we will alert him and restrict. Following javascript is used to check whether particular field is locked or not and we will conditionally alert them or allow in accordance to condtion function fun_status(a,b) {    var get = new htmldb_Get(null,$x(‘pFlowId’).value,               ‘APPLICATION_PROCESS=AP_DEL_OUTPUT_CHECK’,0); get.add(‘AI_PDVD_ID’,a); get.add(‘AI_DELIVERY_PDVD_ID’,b); gReturn = get.get();  var x=gReturn; x = x.trim();     //alert(x); if (x != “Not Exists”)     {        $(“#alert”).html(“Field has been locked by <b>”+x+”</b>”);        $(“#alert”).dialog({modal:true,resizable: false,minHeight: 105,width:380,dialogClass: ‘testclass’});      } }  $(‘#alert’).on(‘dialogclose’, function(event) {         $(“#alert”).dialog(“destroy”);             }); Output:

Read More

Comments Differentiation in Oracle APEX

Comments Differentiation is some recent requirement as new advancements in CSS been implemented. Customer requires differentiation in Image when some comment been added. It has been  implemented with css and little Jquery. Step:1: Include following icon tag in Link Text in report column attributes <i class=”fa fa-comments-o fa-3x icon-grey” aria-hidden=”true”></i> Step:2: Create hidden column to find comments exists for particular row. Step:3: Include following JQuery for color differentiation:        Create Dynamic Action as Execute Javascript Code        Event : After Refresh and Page Load        $(“#report_del_item .t-Report-report td[headers=’GENERAL_COMMENTS’]”).each(function(){ var c = $(this).children(“input[name=’f17′]”).val(); if (c.length != 0) {      $(this).closest(‘tr’).find(“td[headers=’GENERAL_COMMENTS’] a”).children(“i”).css({“color”:”red”}); } }); #report_del_item  – Static Id of Report. td[headers=’GENERAL_COMMENTS’] – Represents General Comments Column $(this).children(“input[name=’f15′]”) – Represents general comments hidden column , Children been specified as all hidden columns will be children to last visbile/display column. .closest(‘tr’)  – Finds closest table row <tr> .children(i)   –  Represents child icon tag inside parent general comments .css         – Adds style element to selector Output: You can notice General Comments to see Comments Differentiation 

Read More

Blank Row Restriction in Oracle APEX

Blank Row Restriction is to avoid unwanted addition of rows in detail report (tabular Form) when a blank row already exists. This functionality can be achieved by Javascript. It is simple but can be reused everywhere. Step:1: Change Add Row Button action as “Defined by Dynamic Action” Step:2: Create Dynamic Action with action as Event : Click Button Action : Execute Javascript Code Code : var i = 1; var count = 0; var c; while (i != 0) { b = “000” + i; //alert(b); b = pad(i,4);                     // calls function pad and pads 4     zeros a = $x(“f05_” + b).value;           // id of mandatory column //alert(a); if (typeof a === “undefined”) { i = 0; } else { c = a.trim(); if (c.length == 0) { count = count + 1; } else { count = 0; } i = i + 1; } }…

Read More

Add Row on the Top in the APEX Tabular Form

 Step 1: Give the Add row button, Action when Button Clicked as Defined by Dynamic action. Step 2: Create a Dynamic action with Event as Click, Selection Type as Button, Button as Add_row and true action as Execute JavaScript Code with Fire on Page load No and add code as addRowTop(); Step 3: Create a function in page header as function addRowTop()  { apex.widget.tabular.addRow(); apex.jQuery(apex.widget.tabular.gTabForm).find(“tr”).last().insertBefore(apex.jQuery(apex.widget.tabular.gTabForm).find(“tr”).first()); } 

Read More

Avoid wrapping of fields in APEX Interactive reports

Due to many columns in the report the data will be wrapped automatically. Resolution: 1. In report attributes, assign the static ID for the column that you want not be shrink. 2. Add the following code in the page header to remove the wrapping. $(function() {         $(“td[headers=column_name’]”).attr(“nowrap”,”nowrap”); });  Output:

Read More

Sending Calendar Invite via APEX Application

With the below code we can send individual emails to the users with an ICS file as attachment. ICS is a global format for calendar files widely being utilized by various calendar and email programs including Google Calendar, Apple iCal, and Microsoft Outlook. These files enable users to share and publish information directly from their calendars over email or via uploading it to the world wide web. Step 1 : Compile the below code CREATE OR REPLACE FUNCTION ical_events (    p_summary       IN   VARCHAR2,    p_description   IN   VARCHAR2,    p_start_date    IN   DATE,    p_end_date      IN   DATE )    RETURN VARCHAR2 AS    lv_desc      VARCHAR2 (20000);    lv_summary   VARCHAR2 (10000);    lv_dtstart   VARCHAR2 (100);    lv_date      VARCHAR2 (100);    lv_dtend     VARCHAR2 (100);    l_retval     VARCHAR2 (32767);    l_lf         CHAR (1)         := CHR (10); BEGIN    lv_summary := ‘SUMMARY:’ || p_summary;    lv_date :=          ‘DTSTAMP:’       || TO_CHAR (SYSDATE, ‘RRRR-MM-DD’)       || ‘T’       || TO_CHAR (SYSDATE, ‘HH24:MI:SS’);    lv_dtstart :=          ‘DTSTART:’       || TO_CHAR (p_start_date, ‘RRRR-MM-DD’)       || ‘T’…

Read More

Download hidden column in APEX classic report

Hidden column cannot be downloaded in classic report if, Display As : Hidden  Include In Export : Yes This can be achieved using the PLSQL Expression: Column attributes->  Display As : Display as Text Column attributes-> Conditional display-> Condition Type : PLSQL Expression Expression : apex_application.g_excel_format = TRUE

Read More

Manual Pagination In Oracle Apex

Step:1 : Create items to set count of rows and display    item to represent pagination. Also create  buttons to navigate different pages.         PXX_FROM – From Value        PXX_TO – To Value        PXX_MAX – Max Value         PXX_PAGINATION – Rows per page        PXX_PAGINATION_DISPLAY – Pagination    Display       Buttons: Save and Next,Save and Previous,               First Page,Last Page Step:2: Restrict data with specified range in report      query, Query is displayed as follows SELECT master_item_id, master_item_id_display, master_pdvd_id, item_id, col1,        col2, col3, col4, col5, col6, col7, col8, col9, NULL, “Check”,        active_ind, SEQUENCE, “replicate_of”   FROM (SELECT ROWNUM rm, master_item_id, master_item_id_display,                master_pdvd_id, item_id, col1, col2, col3, col4, col5, col6,                col7, col8, col9, NULL, “Check”, active_ind, SEQUENCE,                “replicate_of”           FROM (SELECT   c001 master_item_id, seq_id master_item_id_display,                          c002 master_pdvd_id, c003 item_id, c004 col1,                          c005 col2, c006 col3, c007 col4, c008 col5,                          c009 col6, b.c010 col7, c011 col8, NULL col9, NULL,                          NULL “Check”, c012 active_ind,                          (SELECT display_order                             FROM pdvd_tb_lov_dict                            WHERE lov_id = b.c008) SEQUENCE,…

Read More

Losing Data During Validation In Apex Tabular Form !!! – Check In

Step:1: On Submit, Before Computation and Validation – Insert into Collections.   BEGIN          apex_collection.add_member                                (p_collection_name      => ‘PDVD_MASTER_ITEM_DTLS’,                                 p_c001                 => apex_application.g_f03                                                                            (i),                                 p_c002                 => NVL                                                              (:p77_master_pdvd_id,                                                               NULL                                                              ),                                 p_c003                 => apex_application.g_f04                                                                            (i),                                 p_c004                 => apex_application.g_f05                                                                            (i),                                 p_c005                 => apex_application.g_f06                                                                            (i),                                 p_c006                 => apex_application.g_f07                                                                            (i),                                 p_c007                 => apex_application.g_f08                                                                            (i),                                 p_c008                 => apex_application.g_f09                                                                            (i),                                 p_c009                 => apex_application.g_f10                                                                            (i),                                 p_c010                 => lv_v_master_repli_of,                                 p_c011                 => lv_v_delivery_types,                                 p_c012                 => apex_application.g_f15                                                                            (i)                                );       EXCEPTION…

Read More

Field Locks In Oracle Apex

      Step:1: On-change of items, insert into locks table. Dynamic Action : On-Change    Selector : JQuery Selector              [name=f05] Execute Javascript Code,    /* Getting the Program Name Details*/ var c=($(this.triggeringElement ).attr(‘name’).substr(0,3)); var d=this.triggeringElement.id; //alert(d);  var str = d.substring(4,8); if(c==”f05″) { // Assigning PDVD Type var p_pdvd_type=”Master”; //alert(p_pdvd_type); //getting column header value idheader =”#f05_0001_LABEL” ; var p_field_name = $(idheader).closest(“label”).html();    //alert(p_field_name); //getting Master PDVD ID var p_pdvd_id=$(‘#P77_MASTER_PDVD_ID’).val(); //alert(p_pdvd_id); //getting Item ID var p_item_id=$(this.triggeringElement ).attr(‘id’); //alert(p_item_id); //getting Item value var p_item_val=$x(p_item_id).value;…

Read More