APEX

Set Interactive Report Filter with URL Parameters

Interactive Reports are very powerful, the end user can set filters, highlighting, add computed columns, do control breaks or groupings and much more. As a Developer you might sometimes have…

Read More

Progress Bar in Reports in APEX5

APEX can create “Percentage Bars” within a report. This can be achieved using HTML Code in your Report SQL Query. Steps: 1- Create your report: Create an Interactive or Classic Report using SQL query : SELECT CASE           WHEN COLUMN <= 30              THEN    ‘<div class=”a-Report-percentChart” style=”background-color:#000000;width:100%;”><div class=”a-Report-percentChart-fill” style=”width:’                   || COLUMN                   || ‘% ; background-color: 330099;”></div><span class=”u-VisuallyHidden”>’                   || COLUMN                   || ‘</span></div>’                   || COLUMN                   || ‘%’           WHEN COLUMN BETWEEN 30 AND 50              THEN    ‘<div class=”a-Report-percentChart” style=”background-color:#000000;width:100%;”><div class=”a-Report-percentChart-fill” style=”width:’                   || COLUMN                   || ‘% ; background-color:CC0000;”></div><span class=”u-VisuallyHidden”>’                   || COLUMN                   || ‘</span></div>’                   || COLUMN                   || ‘%’           WHEN COLUMN BETWEEN 55 AND 70              THEN    ‘<div class=”a-Report-percentChart” style=”background-color:#000000;width:100%;”><div class=”a-Report-percentChart-fill” style=”width:’                   || COLUMN                   || ‘% ; background-color:#99eb47;”></div><span class=”u-VisuallyHidden”>’                   || COLUMN                   || ‘</span></div>’                   || COLUMN                   || ‘%’        END AS “Progress bar”…

Read More

Displaying images in a Report

Purpose: This document shows user how to include images in report            By assumption we will upload a image to work space and call that particular image through HTML using image name and displays in classical or  interactive report. Another way is that, the user can able to retrieve images from the Database. Benefits: ØUser able to know prior information about subject ØFaster Turnaround. ØReport is used to get the information if user include an image.it will be more helpful. Steps to display images in report Step1: Create a new page Step 2: Create a region èreportèclassical or interactive reportèName for the reportèSQL queryè follow the  below query   Case and Decode both  methods can be done. Based on Requirement modify the query. Example:  CASE                   WHEN gender = ‘MALE’ AND emp_image IS NULL                      THEN  ‘<img src=”#WORKSPACE_IMAGES#not_found_male.jpg” width=”75px;” height=”75px;”/>‘   // uploaded default male icon in workspace and checking for the condition image is available in table or not.                   WHEN gender = ‘FEMALE’ AND emp_image IS NULL                      THEN  ‘<img src=”#WORKSPACE_IMAGES#not_found_female.jpg” width=”75px;” height=”75px;”/>’  // uploaded default Female icon in workspace ans checking for the condition image is available in table or not.                   WHEN emp_image IS NOT NULL  // if  the image already available in the database                      THEN     ‘<img alt=”‘       //HTML tag                            || apex_escape.html_attribute (c.first_name)  // this function returs name of the employee                           || ‘” title=”‘                           || apex_escape.html_attribute (c.first_name) …

Read More

Role based Authorization in Oracle APEX5

Objective: To implement Role based Authorization in Oracle APEX Application, in version 5. Application Item: USER_ROLE Table: ROLE_ACCESS_CONTROL The purpose of this table is to store the privileges on Regions, Buttons and Items, for each role. Page access is controlled through the Region access (Even if one Region in a Page is given access, its Page will appear; Components cannot be created without a “Region”;) Column Name Data Type Comments ROLE_ACCESS_ID NUMBER Primary Key USER_ROLE VARCHAR2(30) Role Name APP_ID NUMBER APEX System Variable PAGE_ID NUMBER APEX System Variable REGION_ID NUMBER APEX System Variable COMPONENT_ID VARCHAR2(30) APEX5 System Variable COMPONENT_NAME VARCHAR2(30) APEX5 System Variable…

Read More

Restrict Copy Paste & Right Click In Apex Page

PURPOSE: The Purpose of this component is to restrict the copy option from the user level of apex page. SCENARIO : 1.Consider in our apex application we are providing any confidential message or data that should not be copied by user level,we can restrict by this component. 2.If we want to provide any notification message for restrict the copy option for that particular confidential page, we can use this component. STEPS TO DO: 1.Create a page in apex and use the region to display some text that to restrict copy option 2.In that region source type the script that given below and save the page and run it. SCRIPT EXPLANATION: We can restrict the copy option by these ways, 1.Restrict Ctrl+C Button. 2.Restrict Mouse Right click . This script will restrict these two ways, //Restrict Ctrl+C Button in javascript <head> <script language=”javascript”> <!– function Disable_Control_C() { var keystroke = String.fromCharCode(event.keyCode).toLowerCase(); if (event.ctrlKey && keystroke == ‘c’) { event.returnValue = false; alert(‘You can not copy here’); } } </script> </head> //This script will restrict the CTRL+C and stop the action in user level <body onkeydown=”javascript:Disable_Control_C()”> </body>…

Read More

Creating Interactive Report as Excel format with applying font for particular column values

PURPOSE: If we want to show any report in excel format in page level with the different font of column values we can use this component script to achieve the scenario. Steps To Follow: Step 1 : Create a interactive report that we need to show in excel format Step 2 : In a report definition type the  query  base on the select list and dense_rank () method  Step 3: You can use the HTML tags in the select list to show the name in different format that we need Excel Format Interactive Report Standard SELECT (‘<b>’ || col1 || ‘<b>’) “xxx”,                 (‘<b>’ || col2 || ‘<b>’) “yyy”,                  (‘<u>’ || col3 || ‘<u>’) “yyy”,                 (‘<i>’ || col4 || ‘<i>’) “yyy”,. . .    FROM (SELECT DECODE (rk, 1, col1, ”) “xxx”,                DECODE (rk, 1, col2 || ‘%’, ”) “yyy”, col3, col4, col5,col6           FROM                 (SELECT col1, col2,                    Col3,col4,col5,col6                                                                          DENSE_RANK () OVER (PARTITION BY col6 ORDER BY tablename1.ROWID)                          rk                   FROM t1, t2                  WHERE t1.col1=t2.col1                    AND condition1                    AND condition2     AND condition3                    AND condition4 )); Step 3 :  Create a query based on this and modify the column name and enter the query in the report region Step 4 : After Entering the query go to Interactive report  à Report Attributes  change the Display Text As  à Standard Report Column  Step 5 : Now we can able to see the report in excel format  Coding Explanation…

Read More

Search Bar in Tabular Form

PURPOSE: The search button in tabular form is helpful to identify the exact data in the tabular form, that will act like a filter in interactive report  shows the particular values what we enter in that search field. Steps To Follow: Step 1: Create Text Field in the Label of Search with Search Button on above Tabular Form. Step 2: Create a Tabular Form where we need to search record. Step 3: Add the following query in region source of the Tabular Form based on the columns need to search Region source: Select  Column1, Column2, Column3, Column4, . . . FROM table_name  WHERE upper(Column1) = upper(:PXX_SEARCH)  or upper(Column2) = upper(:PXX_SEARCH)  or upper(Column3) = upper(:PXX_SEARCH)  upper(Column4) = upper(:PXX_SEARCH)  or :PXX_SEARCH is null . . . Step 4: In that search field item modify ‘Submit when enter pressed ==> YES’ for quick access of values in tabular form.  

Read More

Multiple File Upload in Oracle APEX

This method supports the ability for file inputs to accept and upload multiple files into database. Step 1: Create a File Browse Item. Step 2: In HTML Form Element Attributes set as “Multiple”. For Selecting the Multiple Files at a time. Step 3: Create the Textfield to get the Filename. Step 4: In Dynamic Action “onchange” of File Item. Place the Javascript to get the Selected File Names.    Code: var x = document.getElementById(“P37_FILE”); vlength=x.files.length; var txt = “”; $x(“P37_FILENAME”).value=””; if (‘files’ in x) { for (var i = 0; i <vlength; i++) { if (x.files.length == 0) {             txt = “Select one or more files.”;             $x(“P37_FILENAME”).value=””;         }  else{                 txt += “<br><strong>” + (i+1) + “. file</strong><br>”;                  console.log(“txt =”+txt );                 var file = x.files[i];                 if (‘name’ in file) {                     txt += “name: ” + file.name + “<br>”;                    $x(“P37_FILENAME”).value+=file.name;                 }…

Read More

ADDING A FAVICON TO APEX

 A Favicon (Favorite Icon), also known as a Shortcut Icon, Web site Icon, Tab Icon or Bookmark Icon, is a file containing one or more   small  icons, associated with a particular website or web page. A web designer can create this icon and upload it to a website   (or web page) by several means, and graphical web browsers will then make use of it. Browsers that provide Favicon support typically  display a  page’s Favicon in the browser’s address bar and next to the page’s name in a list of bookmarks. Browsers that support a  tabbed  document interface  typically show a page’s Favicon next to the page’s title on the tab. For applications which are using Universal Theme you don’t have to modify the Page Template anymore if you want to replace the  default Favicon with a custom one. Steps: Step 1: Go to Shared Components > Images and upload your new favicon.ico file. Step 2: Then go to your application and the ‘Edit Application Definition’ button, then the Definition tab. Step 3: Scroll down to Substitutions. Add a new subsitution string called CUSTOM_FAVICON. Enter the substitution string as: #WORKSPACE_IMAGES#favicon.ico Click Apply Changes. Step 4: Navigate to Shared Components > Templates. Filter by ‘Page’ type. Step 5: Edit each of your page templates (tip: start with one that you can test). In the ‘Header’ definition, find the line: <link rel=”icon” href=”#IMAGE_PREFIX#favicon.ico” type=”image/x-icon”> <link rel=”shortcut icon” href=”#IMAGE_PREFIX#favicon.ico” type=”image/x-icon”> Change it to: <link rel=”icon” href=”&CUSTOM_FAVICON.” type=”image/x-icon”> <link rel=”shortcut icon” href=”&CUSTOM_FAVICON.” type=”image/x-icon”> OUTPUT: Before Adding Custom Favicon: After Adding Custom Favicon:   ADDING A FAVICON TO APEX 5 UNIVERSAL …

Read More

DYNAMICALLY ADDING ROWS IN TABULAR FORM IN ORACLE APEX 4.2

A good web design involves the better user interaction and ability to fetch the data in a better way. In Tabular Form user can add rows only by clicking Add Row Button every time. Using this technique user can add multiple entries without clicking Add Row Button and submit them simultaneously. This is a simple and effective solution for creating multiple entries where the number of rows to be entered is indeterminate. Step 1: Create Tabular Form   Step 2: Create Select List in the Tabular Form (Ex: “P22_choose_no_of_rows_to_be_added”)  Step 3: Write JavaScript Function in Page Header Step 4: Creation of Dynamic Action Step 5 : Call the function f_addRow() in Dynamic True Action Step 6: Write JavaScript in Cancel Button OUTPUT: 1. If No row Selected: 2. If No of rows Selected: 3. While Clicking Cancel Button

Read More