APEX


Configuration 

###############################################################




installing apex.

@apexins.sql users users temp /i/

configuring rest services

@apex_rest_config.sql



http://100.100.100.199:8080/i/apex_version.txt

java -jar ords.war static /u01/app/oracle/product/12.2.0.1/db_1/apex/images

java -jar ords.war static  /u02/oradata/images


java -jar ords.war standalone --port 8080 --apex-images /u01/app/oracle/product/12.2.0.1/db_1/apex/images


rm -rf docs examples logs ords.war params readme.html



java -jar ords.war

/u01/app/oracle/apex/ords/conf

java -jar ords.war standalone --port 8080 --apex-images /u01/app/oracle/apex/ords/images

conn apex_public_user/Abc#1234@fed


%LOCALAPPDATA%\Google\Chrome\User Data\

https://www.youtube.com/watch?v=Rl58Ng5RFeI


https://openstax.org/subjects/social-sciences




http://100.100.100.199:8080/i/apex_version.txt

java -jar ords.war static /u01/app/oracle/product/12.2.0.1/db_1/apex/images

java -jar ords.war static  /u02/oradata/images


java -jar ords.war standalone --port 8080 --apex-images /u01/app/oracle/product/12.2.0.1/db_1/apex/images



ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
ALTER PROFILE DEFAULT LIMIT PASSWORD_GRACE_TIME UNLIMITED;
ALTER PROFILE DEFAULT LIMIT PASSWORD_REUSE_MAX UNLIMITED;
ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED;



alter user APEX_040200 identified by Abc#1234 account unlock;
alter user APEX_050100 identified by Abc#1234 account unlock;
alter user APEX_INSTANCE_ADMIN_USER identified by Abc#1234 account unlock;
alter user APEX_LISTENER identified by Abc#1234 account unlock;
alter user APEX_PUBLIC_USER identified by Abc#1234 account unlock;
alter user APEX_REST_PUBLIC_USER identified by Abc#1234 account unlock;




conn APEX_040200/Abc#1234@cdb
conn APEX_050100/Abc#1234@cdb
conn APEX_INSTANCE_ADMIN_USER/Abc#1234@cdb
conn APEX_LISTENER/Abc#1234@cdb
conn APEX_PUBLIC_USER/Abc#1234@cdb
conn APEX_REST_PUBLIC_USER/Abc#1234@cdb


set linesize 200
column username format a60
column profile format a60

select username, account_status,LOCK_DATE, expiry_date, profile, default_tablespace from dba_users order by username;

######################################################################






Contents



TEMP Codes for quick access.

<h2>This application has been moved to another Server.<br></h2>
Please use the following link and use Active Directory userid/password. <br>
<a href="http://192.168.50.144:7777//pls/apex/f?p=504" >http://192.168.50.144:7777//pls/apex/f?p=504</a>
Html basics:

Page Colour:

style="background:none;background-image:none;background-color:lightgrey;padding:0;margin:0;"
style="background:none;background-image:none;background-color:lightblue;padding:0;margin:0;"
style="background:none;background-image:none;background-color:lightred;padding:0;margin:0;"
style="background:none;background-image:none;background-color: #ffff99;padding:0;margin:0;"

BPNG
style="background:none;background-image:none;background-color:#F3E2B4;padding:0;margin:0;"

Region title: background-color:#6F3C07

Region border

Region Header/Footer
<table border="1"><tr><td>
</td></tr></table>

---- without title ---
<table align="center" border="1" background-color: #6699ff" title=””><tr><td>
</td></tr></table>
Load time: #TIMING# second(s).
---- with title ---
<tr><td>
</td></tr></table>
Load time: #TIMING# second(s).
color: #ff0000 

Region Attribute:
Light yellow: #FEFDC2
#BDE0FD
#D9F3F9
<td style="text-align: center; background-color: #FEFDC2">
Light Blue: background-color: #6699ff"
----Center three tables
<table border="1" cellpadding="1" cellspacing="1" style="width: 500px">
  <tr>
                <td style="text-align: center; background-color: #6699ff"><b>Top Level</b></td>
  </tr>
  <tr>
                <td>

                  <table border="1" cellpadding="1" cellspacing="1" style="width: 500px">
                     <tr>
                                <td style="text-align: center; background-color: #6699ff">2nd lvl col1</td>
                                <td style="text-align: center; background-color: #6699ff">2nd lvl col2</td>
                                <td style="text-align: center; background-color: #6699ff">2nd lvl col 3</td>
                     </tr>
                     <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                </tr>
                 </table>
      <p>&nbsp;</p>
</td>
</tr>
</table>

Region Attributes

Top
style=background-color:#99CCFF;
style=background-color: lightgrey;
style=background-color: lightblue;
style=background-color: lightyellow;
style="width:49%; float:left; clear: none;"

<table bgcolor="#CCCCCC"><tr><td>
</td></tr></table>

Images:

Small arrow -> #IMAGE_PREFIX#menu/go-small.png
LOGIN PAGE
CRM
Region Header
<table border="0" cellpadding="1" cellspacing="1" style="width: 100%">
                <tbody>
                                <tr>
                                                <td style="width: 25%">&nbsp;</td>
                                                <td style="height: 100px;width: 100%"></td>
                                                <td style="width: 25%">&nbsp;</td>
                                </tr>
                                <tr>
                                                <td>&nbsp;</td>
<td style="height: 100px; background-color: #ffffcc">
<table align="center" border="01" style="width: 100%; border-style=outset;border-color=red;"><tr><td style="text-align: center; background-color:#6699ff; width=100%"><B>Customer Relationship Management</B></td></tr>
</td></tr>
<tr><td>

Region Footer
</td></tr></table>
<tr><td>
</td>
                <td>&nbsp;</td>
              </tr>
                </tbody>
</table>
Login Button Attribute:
style="height: 44px; color: blue; width: 280px; background-color: lightblue"
text attributes (width 15)
html form element: style="font-size: 24px"
<span style="color: #b22222; font-size: 24px;text-align: center;"><strong>LOGIN NAME</strong></span>



TARMIS
Region Header
<table align="center"  border="0" cellpadding="1" cellspacing="1" style="width: 50%;background-color:lightblue;">
<tbody>
                <tr>
                                <td style="width: 01%;background-color:lightblue;">&nbsp;</td>
                                <td style="height: 150px;width: 0%;background-color:lightblue;">&nbsp;</td>
                                <td style="width: 01%">&nbsp;</td>
                </tr>
                <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                <td style="height: 100px; background-color: #ffffcc">
                 <table align="center" border="01" style="width: 00%; border-style=outset;border-color=red;">
        <tr>    <td style="text-align: center; background-color:#6699ff; width=100%"><B>Tax & Rates Management Information System</B></td></tr>
        <tr>    <td style="text-align: center; background-color:#6699ff; width=100%;"><B><span style="font-size: 24px">TARMIS</span></span></B></td></tr>
        <tr>               <td style="height: 100px;background-color:lightyellow;"><div align="center"><img src="#WORKSPACE_IMAGES#logo.jpg" border="1" width="73" height="74"></div></td>
                </tr>
                </td>
        </tr>
        <tr><td>&nbsp;
Region Footer
    </td>
  </tr></table>
      <td>&nbsp;</td>
  </tr>
  <tr><td>&nbsp;</td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
  </tr>
</tbody>
</table>
Login Button Attribute:
style="height: 44px; color: blue; width: 280px; background-color: lightblue"

Login Text area:
Label
<span style="color: #b22222; font-size: 24px;text-align: center;"><strong>LOGIN NAME</strong></span>

HTML Form Element Attributes: style="font-size: 24px"
style="color: #b22222; font-size: 24px;text-align: center;"
DASHBOARD
Refer Apps: 801 Page 88
Create regions:

Boxh :region header
<style>
td.container > div { width: 100%; height: 100%; overflow:hidden; }
td.container { height: 250px; width:450px }
</style>
<br><br>
<table align="center" style="border:1px solid yellowgreen;border-collapse:collapse;">
<tr><td>

Boxr1c1:
<tr><td>
<table align="center" border="1"><tr><td style="text-align: center; background-color: #6699ff" ><B>Active Parcels by Type</B></td></tr>
<tr><td class="container">

BoxF :region footer

</td></tr></table>



Popup

<BASE target="_self">
<meta http-equiv="Pragma" content="no-cache"/>
Popup window
<script language="JavaScript" type="text/javascript">
function popup_window()
{
w = window.open("", "Window", "width=320,height=400,status=0,toolbar=0,menubar=0");
w.document.write('<html><head><title>Help Window</title>');
w.document.write('</head><body>');
w.document.write('<div><font face="Arial" size="2">This is help page.');
w.document.write('</font></div><p>');
w.document.write('<div><font face="Arial" size="2">Yes, this is help page.');
w.document.write('</font></div><p>');
w.document.write('<div><font face="Arial" size="1"><a href="javascript:window.close();">Close This Window</a></font></div><p>');
w.document.write('</body></html>');
}
</script>
javascript:popup_window();"


Modal Popup - Jquery

https://community.oracle.com/thread/1033046
http://actionet.homelinux.net/apex/f?p=100:59:27173009322906:::::
https://shijesh.wordpress.com/2010/04/10/jquery-modal-form-in-apex-4/
Create a column with link on your report:
Link Text: Whatever you want
Target: URL
URL: javascript:openModal(#YOUR_ID#)
Add the following javascript code to your apex page (Function and Global Variable Declaration) changing the URL for the right APP_ID, PAGE_ID and ITEM_NAME of the popup page you want to open:

<script src="#IMAGE_PREFIX#libraries/jquery-ui/1.8.14/ui/minified/jquery.effects.explode.min.js" type="text/javascript"></script>
<script src="#IMAGE_PREFIX#libraries/jquery-ui/1.8.14/ui/minified/jquery-ui.min.js" type="text/javascript"></script>
Effects: blind, bounce, clip, color, drop, easing, explode,fade,fold, highlight, puff, pulsate, scale, shake, slide, transfer
      show: {effect: "slideDown", duration: 1000},
      hide: {effect: "slideUp",   duration: 1000},
      show: {effect: "clip", direction: "up", duration: 1000},
      hide: {effect: "explode", duration: 1000},

to show close on header:
        $(".ui-dialog-titlebar-close").show(); },  

function openModal(vId){
    var url = 'f?p=<APP_ID>:<APP_PAGE>:&SESSION.::NO:RP,62:P<APP_PAGE>_ID:'+vID;
    var $dialog = $('<div id="ModalFacPenDiv" style="overflow:auto;overflow-y: hidden;"> <iframe id="modalID" src="'+url+'" width="900px" height="260px" frameborder="no" style="overflow:auto;"></iframe></div>');
    $($dialog).dialog({
        open: function(event, ui){
            $(".ui-dialog-titlebar-close").hide(); },
        modal: true ,
        dialogClass: 'noTitle',
        title: 'YOUR TITLE' ,
        width : 920 ,
        height: 380,
        buttons: {
            "Close": function(){
                window.parent.doSubmit('REFRESH');
                $(this).dialog("close");} },
        closeOnEscape: false });
}



<script language="JavaScript" type="text/javascript">
function xx
{
    var url = 'f?p=&APP_ID.:68:&SESSION.::NO:RP,68:P68_APPL_ID:'+id;
    var $dialog = $('<div id="ModalFacPenDiv" style="overflow:auto;overflow-y: hidden;"> <iframe id="modalID" src="'+url+'" width="400px" height="600px" frameborder="no" style="overflow:auto;"></iframe></div>');
    $($dialog).dialog({
      show: {effect: "slideDown", duration: 1000},
      hide: {effect: "SlideUp",duration: 1000},
        open: function(event, ui){
            $(".ui-dialog-titlebar-close").show(); },
        modal: true ,
        dialogClass: 'noTitle',
        title: 'Checklist' ,
        width : 920 ,
        height: 380,
        buttons: {
            "Close": function(){
                window.parent.doSubmit('REFRESH');
                $(this).dialog("close");} },
        closeOnEscape: false });
}
</script>
      show: {effect: "clip", direction: "up", duration: 1000},
      hide: {effect: "explode",duration: 1000},

      show: {effect: "puff", duration: 1000},
      hide: {effect: "explode",duration: 1000},

      show: {effect: "slideDown", duration: 1000},
      hide: {effect: "slideUp",   duration: 1000},

      show: {effect: "slideDown", direction: "down", mode : "hide"},
      hide: {effect: "slideUp",  direction: "up",    mode : "hide"},

---positining button at top ---- No gud.
$( "#dialog-form" ).dialog({
 autoOpen: false,
 height: 300,
 width: 350,
 modal: true,
 buttons : {
 "search" : function(){
 $(this).css({position:top})
 },
 "use selected" : function(){}
 }
 });
--- jquery dialog options--------------------------------------
-----------------------------------------

Effect: only SlideUp, SlideDown works.??
Function alrt(msg)
{
 var msg = "Valuation data not found";
 var len = msg.length * 10;
 var $dialog = $('<div class="ui-dialog-titlebar ui-widget-header" data-role="popup" id="myPopup">  <p>'+msg+'</p></div>');
  $($dialog).dialog({
      show: {effect: "slideUp", duration: 1000},
      hide: {effect: "SlideDown",duration: 1000},
        open: function(event, ui){
            $(".ui-dialog-titlebar-close").hide(); },
        modal: true ,
        dialogClass: 'noTitle',
        title: 'MESSAGE',
        width : len ,
        height: 150,
        buttons: {
            "Close": function(){$(this).dialog("close");}
         },closeOnEscape: true });
}

You'll need to set Embed in Frames to allow or Allow from same origin (this one is better/more secure) on Security Attributes > Browser Security.
I'm assuming that in the popup page you have the necessary processes to show the info based on some ID.
Popup
<a href="#myPopup" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all">Show Popup</a>

<div data-role="popup" id="myPopup">  <p>This is a simple popup.</p></div>
    var $dialog = $('<a href="#myPopup" data-rel="popup" class="ui-btn ui-btn-inline ui-corner-all">Show Popup</a>');

$('.popup').click(function(event) {
    event.preventDefault();
    window.open($(this).attr("href"), "popupWindow", "width=600,height=600,scrollbars=yes");
});
Alert
Var $dialog = $(‘<div></div>’)
                       .html(‘Just a simple text.’)
                      .dialog({
                         autoOpen : false
                        , title         :’Simple Text’
                        , modal     : true
                        , width      : ‘auto’
                        , buttons   : [ { text: “OK”
                                                , click: function()
                                                {
                                                            $dialog.dialog(‘close’);
                                                }
                                           }
                                         ]
            });
 $dialog,dialog(‘open’);



Jquery Alert
http://eltimn.github.io/jquery-bs-alerts/
<div data-alerts="alerts" data-titles="{'warning': '<em>Warning!</em>'}" data-ids="myid" data-fade="3000"></div>
<button id="warn-me" class="btn">Click to see a warning alert</button>
<script>
$("#warn-me").click(function() {
  $(document).trigger("add-alerts", [
    {
      'message': "This is a warning.",
      'priority': 'warning'
    }
  ]);
});
</script>
http://rimblas.com/blog/2013/11/modal-page-window-feedback/
function openMultiBox(){
     var apexSession = $v('pInstance');
    var apexAppId = $v('pFlowId');
     var question = $x('P213_QUESTION').value;
     var questType = $x('P213_QUESTION_TYPE').value;
     $(function(){
          vMultiBox = '<div id="multiBox" title="iCreate: Get Multi Values"><iframe src="f?p='+apexAppId+':214:'+apexSession+'::NO:214:P214_QUESTION_TYPE:'+questType+'" width="875" height="500" title="iCreate: Get Multi Values"></iframe></div>'
          $(document.body).append(vMultiBox);
          $("#multiBox").dialog({            
               bgiframe: true,
               stack: true,
               modal: true,
               height: 550,
               width: 900,
               position: 'top',
               minHeight: 550,
               minWidth: 900,
               resizable: false,
               autoResize: true,
               draggable: false,
               close : function(){$("#multiBox").remove();}
          });
     });     
}
Effect:
         $(document).ready(function() {
            $('#box-2').click(function() {
               $( "#box-2" ).effect({
                  effect: "explode",
                  easing: "easeInExpo",
                  pieces: 4,
                  duration: 5000
               });
            });
         });

Jquery Buttons

http://stackoverflow.com/questions/11141607/add-an-image-to-the-jquery-button
<button>Trash</button>
<style>
    .ui-button .ui-button-icon-primary {
        background: url('/my-custom-trash-image.png');
    }
</style>
<script>
    $(function() {
        $('button').button({
            icons: {
                primary: 'ui-icon-trash'
            },
            text: false
        });
    });
</script>

BUGS
Jquery dialog shriks:
Turns out that in the CSS file, .ui-widget-content p was setting a height of 36px. I went to comment that out and replace with a height: 100%; so I discovered that although the properties for the .dialog were set correctly, it was a CSS property from elsewhere that can potentially make drilling down the problem very tricky. It was just one line of code that did the trick. Thanks for the pointers and help. :)

Jquery
    $(document).ready(function(){

    //get the height and width of the page
    var window_width = $(window).width();
    var window_height = $(window).height();

    //vertical and horizontal centering of modal window(s)
    /*we will use each function so if we have more then 1
    modal window we center them all*/
    $('.modal_window').each(function(){

        //get the height and width of the modal
        var modal_height = $(this).outerHeight();
        var modal_width = $(this).outerWidth();

        //calculate top and left offset needed for centering
        var top = (window_height-modal_height)/2;
        var left = (window_width-modal_width)/2;

        //apply new top and left css values
        $(this).css({'top' : top , 'left' : left});

    });

        $('.activate_modal').click(function(){

              //get the id of the modal window stored in the name of the activating element
              var modal_id = $(this).attr('name');

              //use the function to show it
              show_modal(modal_id);

        });

        $('.close_modal').click(function(){

            //use the function to close it
            close_modal();

        });

    });

    //THE FUNCTIONS

    function close_modal(){

        //hide the mask
        $('#mask').fadeOut(500);

        //hide modal window(s)
        $('.modal_window').fadeOut(500);

    }
    function show_modal(modal_id){

        //set display to block and opacity to 0 so we can use fadeTo
        $('#mask').css({ 'display' : 'block', opacity : 0});

        //fade in the mask to opacity 0.8
        $('#mask').fadeTo(500,0.8);

         //show the modal window
        $('#'+modal_id).fadeIn(500);

    }

Draggable Region

HTML Header
//draggable reports
<script type="text/javascript">
$(function() {
  $("#draggable3").draggable({scroll:true});
});
</script>

REGION HEADER
<table class="ui-widget-content" id="draggable3" border="0" cellpadding="0" cellspacing="0" summary="">
<tr>
<th class="t14RegionHeader2">Heading</th>
</tr>
<tr>
<td class="t14RegionBody" colspan="2">

REGION FOOTER
</td>
</tr>
</table>

Change Region Template to No Template.



Checkbox to toggle show/hide a region

1. Add static ID "REGION1" in the Attributes section of the region to control.
2. In the checkbox, add the function name to be called in the HTML Form Element Attributes of the Checkbox element.
onClick="f_ToggleRegion();"
function f_ToggleRegion() {

 chkbox_name = html_GetElement('P17_CHECKBOX_0').name;
 chkbox_array = document.getElementsByName(chkbox_name);

 for (i=0; i < chkbox_array.length; i++) {
   if (chkbox_array[i].checked) {
     document.getElementById('REGION1').style.display = "";
   } else {
     document.getElementById('REGION1').style.display = "none";
   }
 }
}

Display only item layout


In javascript code, Execute when Page Loads:
$('#P61_STUD_NAME').attr("readonly","readonly").css({"font-weight":"bold","color":"red"});

iFrame

<div>
<iframe src="f?p=&APP_ID.:62:&SESSION.:::" frameborder="no" width="700" height="150">
</iframe>
</div>

Calling  Global procedure from page - AJAX

  v_svr = html_GetElement('P19_SVR').value;
  var get=new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=print_rcpt',0);
  get.add('G_REF',i_appl);
  get.add('G_BYTE',0);   
  var gReturn=get.get();
  if (gReturn)
     {
      var url = 'http://'+v_svr+'/i/DC/'+'R'+i_appl+'.pdf';
      window.open (url);
     }
 }else{
     alert ('Receipt Details not Complete!!');
}

Calling  package from url

function xx{
//  l_url = l_url +'/pls/apex/dc_lbls.dlir_lbl1';
  var get=new htmldb_Get(null,&APP_ID.,'APPLICATION_PROCESS=print_lbl1',0);
  get.add('G_ID',id);
  get.add('G_TYPE',ty);   
  var gReturn=get.get();
alert (gReturn);
  if ( gReturn == 1)
  {
      var url = 'http://'+v_svr+'/i/DC/'+'l'+id+'.pdf';
alert (url);
      window.open (url);
     }
  }else{
     alert ('Label not generated!!');
  }
}


apex plug-ins

https://code.google.com/archive/p/plsql-utils/downloads

AnyChart

--- good examples --
converting mapinfo .tab to xml
One option would be to use the GDAL <http://www.gdal.org/> ogr2ogr
program to convert the data to and XML format (KML, GML), thusly:
 
$ ogr2ogr -f GML x.gml foo.tab
 
$ ogr2ogr -f KML x.kml foo.tab
 
Then process the XML in your ruby application.

AnyMap

https://community.oracle.com/message/3139658#3139658

XMl Converter

(CSV to XML Converter)
(image,document, audio, video,
Image in xml code sample:
<xml><image>AAECAwQFBgcICQ==</image></xml>
I guess its base64 cdoe.

Apex Manuals:

https://docs.oracle.com/cd/E37097_01/index.htm
Auto refresh page
<head>
<meta http-equiv="refresh" content="30">
</head>

Apex samples

http://actionet.homelinux.net/apex/f?p=100:64:2961027639064::NO:::

APEX 5 - Oracle APEX 5.0 Articles


http://dgielis.blogspot.com/  -- good articles.
http://oracleapexbynandinithakur.blogspot.com/2012/06/changing-background-color-in-oracle.html

Free Report Write




Page Authentication

IS_AUTHENTICATED Function
This function checks if the user is authenticated in the session and returns TRUE if the user is already logged in or FALSE if the user of the current session is not yet
authenticated.
Syntax
APEX_AUTHENTICATION.IS_AUTHENTICATED
return BOOLEAN;
Example
In this example,
IS_AUTHENTICATED
is used to emit the username if the user has
already logged in or a notification if the user has not.
if apex_authentication.is_authenticated then
sys.htp.p(apex_escape.html(:APP_USER)||', you are known to the system');
else
sys.htp.p('Please sign in');
end if;

LDAP Authentication



Working solution  (setup as on PROD HRIS )


Steps:
Add ACL
-- exec as sysdba
BEGIN
  DBMS_NETWORK_ACL_ADMIN.create_acl (
    acl          => 'ldap_acl_file.xml',
    description  => 'ACL to grant access to LDAP server',
    principal    => 'APEX_040200',
    is_grant     => TRUE,
    privilege    => 'connect',
    start_date   => SYSTIMESTAMP,
    end_date     => NULL);

  DBMS_NETWORK_ACL_ADMIN.assign_acl (
    acl         => 'ldap_acl_file.xml',
    host        => '192.168.50.137',
    lower_port  => 389,
    upper_port  => NULL);

  COMMIT;
END;
/
begin
  DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE (
    acl          => 'ldap_acl_file.xml',
    principal    => 'APEX_040200',
    is_grant     => TRUE,
    privilege    => 'resolve',
    position     => null);
end;
/
COMMIT;

Check authentication using PL/SQL
-- this worked ---
--telnet domain-controller 389
-- if nothing happens then Firewall is Closed - thats ok
DECLARE
    vSession DBMS_LDAP.session;
    vResult PLS_INTEGER;
BEGIN
    DBMS_LDAP.use_exception := TRUE;
    vSession := DBMS_LDAP.init
    ( hostname => '192.168.50.137'
    , portnum => 389
    );
       -- Bind to the directory
    vResult := DBMS_LDAP.simple_bind_s(vSession, 'datecpng\ksinha','password');
    DBMS_OUTPUT.PUT_LINE(RPAD('simple_bind_s Returns ',25,' ') || ': '
       || TO_CHAR(vResult));
         
END;
/

Create Apex Authentication
Add a new authentication scheme.
Scheme type LDAP Directory

Add function for LDAP AUTH on apex.
CREATE OR REPLACE FUNCTION apex_040200.ldap_auth(
  p_username IN VARCHAR2,
  p_password IN VARCHAR2
  /*
22.12.14 ks created as per suggestion for LDAP authorisation. 
GRANT EXECUTE ON apex_040200.ldap_auth TO my_workspace_user;
GRANT EXECUTE ON apex_040200.ldap_auth TO hris;
  */
)
RETURN BOOLEAN IS
  l_ldap_host     VARCHAR2(256) := '192.168.50.137';
  l_ldap_port     VARCHAR2(256) := '389';
  l_ldap_base     VARCHAR2(256) := 'dc=datecpng,dc=local';
  l_dn_prefix     VARCHAR2(100) := 'datecpng\'; -- Amend as desired'.
--  l_ldap_base     VARCHAR2(256) := 'dc=example,dc=com';
--  l_dn_prefix     VARCHAR2(100) := 'USERS\'; -- Amend as desired'.
  l_retval        PLS_INTEGER;
  l_session       DBMS_LDAP.session;
BEGIN
  -- Choose to raise exceptions.
  DBMS_LDAP.use_exception := TRUE;
    -- Connect to the LDAP server.
  l_session := DBMS_LDAP.init(hostname => l_ldap_host,
                              portnum  => l_ldap_port);
    l_retval := DBMS_LDAP.simple_bind_s(ld     => l_session,
                                      dn     => l_dn_prefix || p_username,
                                      passwd => p_password);
  -- No exceptions mean you are authenticated.
  RETURN TRUE;
EXCEPTION
  WHEN OTHERS THEN
    -- Exception means authentication failed.
    l_retval := DBMS_LDAP.unbind_s(ld => l_session);
    APEX_UTIL.set_custom_auth_status(p_status => 'Incorrect username and/or password');
    RETURN FALSE;   
END;
/
Add application specific verification to restrict users.
Function auth_user return boolean is
 v_lid varchar2(40);
 v_vid varchar2(40);
begin
  v_lid := v('APP_USER');
  --those users created on application will be authorised
  select login_id into v_vid from hr_users where upper(login_id) = upper(v_lid);
  if sql%found then 
     return true;
  else
     return FALSE;
  end if;
 Exception
   when others then return FALSE;
end auth_user;


Modify auth scheme to allow application specific users .
With above setup every AD user will be authorised to use the application.
To restrict to application specific users only, create a function as above and add
The  verify function as below:
Hris.hrd_util.auth_user

------END of WORKIGN CODE--------------------------------------------------------------------------------
error debug:
Solved the problem after a hard day scratching my head for a few hours.
AD doesn't allow anonymous access by default. Therefore, I had to find the correct ' distinguished Name' in order to get access (which is the long string without the 'LDAP://SERVER_OR_DOMAIN/').
If you ever encounter the '80090308: LdapErr: DSID-0C090334, comment: AcceptSecurityContext error' error you should refer to this thread or this serverfault question.
Thanks for the help.

host: 192.168.50.137
port 389
cn=%LDAP_USER%,l=amer,dc=datecpng,dc=local
Windows
Datecpng\%LDAP_USER%
unix??
uid=%LDAP_USER%,ou=People,dc=datecpng,dc=local
OPTIONS
example 1
-- Run as sysdba
DECLARE
  l_acl       VARCHAR2(100) := 'ldapacl.xml';
  l_desc      VARCHAR2(100) := 'LDAP Authentication for ldap.mydomain.com';
  l_principal VARCHAR2(30)  := 'APEX_040100'; -- upper case
  l_host      VARCHAR2(100) := 'ldap.mydomain.com';
BEGIN
  -- Create the new ACL.
  -- Also, provide one starter privilege, granting the schema the privilege to connect.
  dbms_network_acl_admin.create_acl(l_acl, l_desc, l_principal, TRUE, 'connect');

  -- Now grant privilege to resolve DNS names.
  dbms_network_acl_admin.add_privilege(l_acl, l_principal, TRUE, 'resolve');

  -- Specify which hosts this ACL applies to.
  dbms_network_acl_admin.assign_acl(l_acl, l_host);

  COMMIT;
END;
Now configue a new authentication scheme in Application Express to authenticate via LDAP.
In your Apex application go to Shared Components -> Authentication Schemes, and click the Create button.
Choose the radio button Based on a pre-configured scheme from the gallery, and click Next.
Provide a name, for example LDAP Authentication.
Select the scheme type LDAP Directory.
Now the new Settings region appears. Fill in the values as in the example below, and make substitutions to host, domain, ou, etc. as necessary.
Note that the substitution string %LDAP_USER% will contain the username that you will enter in the login screen.

For Microsoft Active Directory the entry is slightly different (make substitutions as necessary). Note that in this example, the Active Directory server name is ad.mydomain.com.
http://ruepprich.files.wordpress.com/2012/10/ldap_ad_settings1.png?w=550&h=180
Once all fields are filled in, click the Create button. You should now see the newly created authentication screen in the list, and marked as Current.

Now try to log into your application.
If you have trouble logging in, you can use the PL/SQL procedure below to trap any error messages:
-- Code by Scott Spadofore
DECLARE
  l_retval PLS_INTEGER;
  l_retval2 PLS_INTEGER;
  l_session dbms_ldap.session;
  l_ldap_host VARCHAR2(256);
  l_ldap_port VARCHAR2(256);
  l_ldap_user VARCHAR2(256);
  l_ldap_passwd VARCHAR2(256);
  l_ldap_base VARCHAR2(256);
BEGIN

  l_retval := -1;
  dbms_ldap.use_exception := TRUE;
  l_ldap_host := 'ldap.mydomain.com';
  l_ldap_port := '389';
  l_ldap_user := 'uid=cruepprich,ou=People,dc=mydomain,dc=com';
  l_ldap_passwd := 'secret';

  l_session := dbms_ldap.init(l_ldap_host, l_ldap_port);
  l_retval := dbms_ldap.simple_bind_s(l_session,
  l_ldap_user,
  l_ldap_passwd);
  dbms_output.put_line('Return value: ' || l_retval);
  l_retval2 := dbms_ldap.unbind_s(l_session);

EXCEPTION
  WHEN OTHERS THEN
    dbms_output.put_line(rpad('ldap session ', 25, ' ') || ': ' ||
    rawtohex(substr(l_session, 1, 8)) || '(returned from init)');
    dbms_output.put_line('error: ' || SQLERRM || ' ' || SQLCODE);
    dbms_output.put_line('user: ' || l_ldap_user);
    dbms_output.put_line('host: ' || l_ldap_host);
    dbms_output.put_line('port: ' || l_ldap_port);

    l_retval := dbms_ldap.unbind_s(l_session);
END;

EXAMPLE 2

Network ACL

From Oracle 11g onward, access to network services is controlled using Access Control Lists (ACLs). You will need to create an ACL to allow access to the LDAP server. An example of an ACL is shown below, which assumes the user needing access to the LDAP server is called "APEX_040200".
BEGIN
  DBMS_NETWORK_ACL_ADMIN.create_acl (
    acl          => 'ldap_acl_file.xml', 
    description  => 'ACL to grant access to LDAP server',
    principal    => 'APEX_040200',
    is_grant     => TRUE, 
    privilege    => 'connect',
    start_date   => SYSTIMESTAMP,
    end_date     => NULL);
 
  DBMS_NETWORK_ACL_ADMIN.assign_acl (
    acl         => 'ldap_acl_file.xml',
    host        => 'ldap.example.com', 
    lower_port  => 389,
    upper_port  => NULL);
 
  COMMIT;
END;
/

Authentication Procedure

The LDAP_AUTH function is created in the APEX_040200 schema. It accepts the username and password and returns a boolean of TRUE if the authentication is successful or FALSE if not. You will need to adjust the LDAP settings before using it.
CREATE OR REPLACE FUNCTION apex_040200.ldap_auth(
  p_username IN VARCHAR2,
  p_password IN VARCHAR2
)
RETURN BOOLEAN IS
  l_ldap_host     VARCHAR2(256) := 'ldap.example.com';
  l_ldap_port     VARCHAR2(256) := '389';
  l_ldap_base     VARCHAR2(256) := 'dc=example,dc=com';
  l_dn_prefix     VARCHAR2(100) := 'USERS\'; -- Amend as desired'.
 
  l_retval        PLS_INTEGER;
  l_session       DBMS_LDAP.session;
BEGIN
  -- Choose to raise exceptions.
  DBMS_LDAP.use_exception := TRUE;
  
  -- Connect to the LDAP server.
  l_session := DBMS_LDAP.init(hostname => l_ldap_host,
                              portnum  => l_ldap_port);
  
  l_retval := DBMS_LDAP.simple_bind_s(ld     => l_session,
                                      dn     => l_dn_prefix || p_username,
                                      passwd => p_password);
                                      
  -- No exceptions mean you are authenticated.
  RETURN TRUE;
EXCEPTION
  WHEN OTHERS THEN
    -- Exception means authentication failed. 
    l_retval := DBMS_LDAP.unbind_s(ld => l_session);
    APEX_UTIL.set_custom_auth_status(p_status => 'Incorrect username and/or password');
    RETURN FALSE;    
END;
/
The previous function only checks LDAP authentication. If you need to authorize against a specific LDAP group as well, you will need to add a little more code, such as the following. Thanks the Roel Hartman for his blog post on this subject, which saved me a lot of time.
CREATE OR REPLACE FUNCTION apex_040200.ldap_auth(
  p_username IN VARCHAR2,
  p_password IN VARCHAR2
)
RETURN BOOLEAN IS
  l_ldap_host     VARCHAR2(256) := 'ldap.example.com';
  l_ldap_port     VARCHAR2(256) := '389';
  l_ldap_base     VARCHAR2(256) := 'dc=example,dc=com';
  l_dn_prefix     VARCHAR2(100) := 'USERS\'; -- Amend as desired'.
  l_auth_group    VARCHAR2(100) := 'MY_APP_LDAP_GROUP'; -- Amend as desired'.
 
  l_retval        PLS_INTEGER;
  l_session       DBMS_LDAP.session;
  l_attrs         DBMS_LDAP.string_collection;
  l_message       DBMS_LDAP.message;
  l_entry         DBMS_LDAP.message;
  l_attr_name     VARCHAR2(256);
  l_ber_element   DBMS_LDAP.ber_element;
  l_vals          DBMS_LDAP.string_collection;
  l_ok            BOOLEAN;
BEGIN
  -- Choose to raise exceptions.
  DBMS_LDAP.use_exception := TRUE;
  
  -- Connect to the LDAP server.
  l_session := DBMS_LDAP.init(hostname => l_ldap_host,
                              portnum  => l_ldap_port);
  
  l_retval := DBMS_LDAP.simple_bind_s(ld     => l_session,
                                      dn     => l_dn_prefix || p_username,
                                      passwd => p_password);
                                      
  -- No exceptions mean you are authenticated. Now check if authorized.
 
  -- Get all "memberOf" attributes    
  l_attrs(1) := 'memberOf';
 
  -- Searching for the user info using his samaccount (windows login)
  l_retval := DBMS_LDAP.search_s(ld       => l_session,
                                 base     => l_ldap_base,
http://ruepprich.files.wordpress.com/2012/10/ldap_settings.png?w=550&h=138
http://ruepprich.files.wordpress.com/2012/11/ldap_list.png?w=550
                                 scope    => DBMS_LDAP.scope_subtree,
                                 filter   => '(&(objectClass=*)(sAMAccountName=' || p_username || '))',
                                 attrs    => l_attrs,
                                 attronly => 0,
                                 res      => l_message);
  
  -- Get the first and only entry.
  l_entry := DBMS_LDAP.first_entry(ld  => l_session,
                                   msg => l_message);
  
  -- Get the first Attribute for the entry.
  l_attr_name := DBMS_LDAP.first_attribute(ld        => l_session,
                                           ldapentry => l_entry,       
                                           ber_elem  => l_ber_element);
 
  -- Loop through all "memberOf" attributes  
  WHILE l_attr_name IS NOT NULL LOOP
    -- Get the values of the attribute
    l_vals := DBMS_LDAP.get_values(ld        => l_session,
                                   ldapentry => l_entry,
                                   attr      => l_attr_name);
 
    -- Check the contents of the value
    FOR i IN l_vals.FIRST .. l_vals.LAST LOOP
      -- Check the user is a member of the required group. 
      l_ok := INSTR(UPPER(l_vals(i)), l_auth_group) > 0 ;
      EXIT WHEN l_ok;
    END LOOP;
    EXIT WHEN l_ok;    
 
    l_attr_name := DBMS_LDAP.next_attribute(ld        => l_session,
                                            ldapentry => l_entry,       
                                            ber_elem  => l_ber_element );
  END LOOP;
 
  l_retval := dbms_ldap.unbind_s(ld => l_session);
 
  IF NOT l_ok THEN
    APEX_UTIL.set_custom_auth_status (p_status => 'You are not in the correct LDAP group to use this application.');
  END IF;  
 
  -- Return authentication + authorization result.  
  RETURN l_ok;
EXCEPTION
  WHEN OTHERS THEN
    -- Exception means authentication failed. 
    l_retval := DBMS_LDAP.unbind_s(ld => l_session);
    APEX_UTIL.set_custom_auth_status (p_status => 'Incorrect username and/or password');
    RETURN FALSE;    
END;
/
Make sure you the relevant workspace user can execute the procedure. For example, if my workspace user were called MY_WORKSPACE_USER, I would do the following.
GRANT EXECUTE ON apex_040200.ldap_auth TO my_workspace_user;

Test It

Regardless of the type of authentication function you use, you can test it using the following code.
SET SERVEROUTPUT ON
DECLARE
  l_result BOOLEAN;
BEGIN
  l_result := apex_040200.ldap_auth('myuser', 'mypassword');
  IF l_result THEN
    DBMS_OUTPUT.put_line('OK');
  ELSE
    DBMS_OUTPUT.put_line('NOT OK');
  END IF;
END;
/
OK
 
PL/SQL procedure successfully completed.
 
SQL>

Create Custom Authentication Scheme

With the authentication function in place, you can create a custom authentication scheme as follows.
Application > Shared Components > Authentication Schemes
Click the "Create" button.
Select the "Based on a pre-configured scheme from gallery" option and click the "Next" button.
Enter a name, select the Scheme Type of "Custom" and an Authentication Function Name of "apex_040200.ldap_auth".
Click the "Create Authentication Scheme" option.
Run the application and test the authentication.
Tests:
BEGIN
    IF APEX_LDAP.authenticate
         ( p_username    => 'Wolf Patrick'
         , p_password    => NULL
         , p_search_base => '[...rest of the DN...],DC=sphinx,DC=co,DC=at'
         , p_host        => 'your-active-directory-server'
         , p_port        => 389
         )
    THEN
        DBMS_Output.put_line('ok');
    ELSE
        DBMS_Output.put_line('not ok');
    END IF;
END;
example 1

Using Pl/sql in report region


Jquery samples - html

https://jqueryui.com/dialog/

Using For loop


USERENV – Db environments

select
SYS_CONTEXT('USERENV','ACTION'),
SYS_CONTEXT('USERENV','AUDITED_CURSORID'),
SYS_CONTEXT('USERENV','AUTHENTICATED_IDENTITY'),
SYS_CONTEXT('USERENV','AUTHENTICATION_DATA'),
SYS_CONTEXT('USERENV','AUTHENTICATION_METHOD'),
SYS_CONTEXT('USERENV','AUTHENTICATION_TYPE'),
SYS_CONTEXT('USERENV','BG_JOB_ID'),
SYS_CONTEXT('USERENV','CLIENT_IDENTIFIER'),
SYS_CONTEXT('USERENV','CLIENT_INFO'),
SYS_CONTEXT('USERENV','CURRENT_BIND'),
SYS_CONTEXT('USERENV','CURRENT_SCHEMA'),
SYS_CONTEXT('USERENV','CURRENT_SCHEMAID'),
SYS_CONTEXT('USERENV','CURRENT_SQL'),
SYS_CONTEXT('USERENV','CURRENT_SQL_LENGTH'),
SYS_CONTEXT('USERENV','CURRENT_USER'),
SYS_CONTEXT('USERENV','CURRENT_USERID'),
SYS_CONTEXT('USERENV','DB_DOMAIN'),
SYS_CONTEXT('USERENV','DB_NAME'),
SYS_CONTEXT('USERENV','DB_UNIQUE_NAME'),
SYS_CONTEXT('USERENV','ENTRYID'),
SYS_CONTEXT('USERENV','ENTERPRISE_IDENTITY'),
SYS_CONTEXT('USERENV','EXTERNAL_NAME'),
SYS_CONTEXT('USERENV','FG_JOB_ID'),
SYS_CONTEXT('USERENV','GLOBAL_CONTEXT_MEMORY'),
SYS_CONTEXT('USERENV','GLOBAL_UID'),
SYS_CONTEXT('USERENV','HOST'),
SYS_CONTEXT('USERENV','IDENTIFICATION_TYPE'),
SYS_CONTEXT('USERENV','INSTANCE'),
SYS_CONTEXT('USERENV','INSTANCE_NAME'),
SYS_CONTEXT('USERENV','IP_ADDRESS'),
SYS_CONTEXT('USERENV','ISDBA'),
SYS_CONTEXT('USERENV','LANG'),
SYS_CONTEXT('USERENV','LANGUAGE'),
SYS_CONTEXT('USERENV','MODULE'),
SYS_CONTEXT('USERENV','NETWORK_PROTOCOL'),
SYS_CONTEXT('USERENV','NLS_CALENDAR'),
SYS_CONTEXT('USERENV','NLS_CURRENCY'),
SYS_CONTEXT('USERENV','NLS_DATE_FORMAT'),
SYS_CONTEXT('USERENV','NLS_DATE_LANGUAGE'),
SYS_CONTEXT('USERENV','NLS_SORT'),
SYS_CONTEXT('USERENV','NLS_TERRITORY'),
SYS_CONTEXT('USERENV','OS_USER'),
SYS_CONTEXT('USERENV','POLICY_INVOKER'),
SYS_CONTEXT('USERENV','PROXY_ENTERPRISE_IDENTITY'),
--SYS_CONTEXT('USERENV','PROXY_GLOBAL_UID'),
SYS_CONTEXT('USERENV','PROXY_USER'),
SYS_CONTEXT('USERENV','PROXY_USERID'),
SYS_CONTEXT('USERENV','SERVER_HOST'),
SYS_CONTEXT('USERENV','SERVICE_NAME'),
SYS_CONTEXT('USERENV','SESSION_USER'),
SYS_CONTEXT('USERENV','SESSION_USERID'),
SYS_CONTEXT('USERENV','SESSIONID'),
SYS_CONTEXT('USERENV','SID'),
SYS_CONTEXT('USERENV','STATEMENTID'),
/*
*/
SYS_CONTEXT('USERENV','TERMINAL')

from dual; It turns out I had the answer all along in another solution I'd developed. To do this, grant APEX_ADMINISTRATOR_ROLE to a user designed specifically for this sort of thing. Then simply call Apex_Instance_Admin.Get_Parameter('INBOUND_PROXIES') to access the list. You can then expose a get_client_ip function from here to any application that needs it.

Open WordDoc Apex Call


function openDoc(doc)
//open a document in a separate browser window
{var img_folder; var l_svr; var l_url;;
 l_note = $v('P44_NOTE_ID');
 img_folder = '/i/PSC/';
l_svr = 'http://'+get_svr();
 l_url = l_svr+img_folder+doc;
 popupURL(l_url);
}

 html background image – from apex



<style>
 <!--
 body {
 background-image: url(image.gif);
 background-repeat: no-repeat;
 background-attachment: fixed;
 }
 //-->
 </style>

PDF Report Generator

JSP




Flowchart in HTMl



Tools:


chk this,

org chart.

https://apex.oracle.com/pls/apex/f?p=58479:5::::::
Javascript in apex Page



Jquery Alert

--- working code
function alrt()
{
   var $dialog = $('<div></div>')
   .html('<b>!!!Amount Not Valid!!!</b>')
              .dialog({
               autoOpen : false
               ,title    : 'ALERT'
               ,modal    : true
              ,width     : "300px"
              ,timer     : 2000
              ,buttons  : [ { text: "Close"
              , click: function()
              {
                $dialog.dialog('close');
              }
             }
             ]
             });
       $dialog.dialog('open');
}
-----
<script language="JavaScript1.1" type="text/javascript">
<!--
function  none()
{
 var $dialog = $('<div></div>')
              .html('Just a Simple Text.')
              .dialog({
                      autoOpen : false
                     ,title    : 'Simple Text'
                     ,modal    : true
                     ,width    : "300px" ,timer : 2000
                     ,buttons  : [ { text: "OK"
                                   , click: function()
                                      {
                                          $dialog.dialog('close');
                                       }
                                    }
                                  ]
                       });
 $dialog.dialog('open');
}
//-->
</script>

Animations using javascript


Image Bubble:
http://www.dynamicdrive.com/

APEX API

https://docs.oracle.com/cd/E37097_01/doc.42/e35127/javascript_api.htm#AEAPI266
apex.submit( 'DELETE' );
apex.confirm("Save Department?", {
  request:"SAVE",
  set:{"P1_DEPTNO":10, "P1_EMPNO":5433}
  });
apex.item( "P1_ITEM" ).addValue('100') ;

apex.item( "P1_ITEM" ).disable() ;

apex.item( pNd ).getValue()

alert( "P1_ITEM value = " +  apex.item( "P1_ITEM" ).getValue()  );
apex.item( "P1_ITEM" ).hide(TRUE);
apex.item( "P1_ITEM" ).setFocus();
apex.item( "P1_ITEM" ).setStyle( "color", "red" );

Javascript Onmouse???

In attribute to disable when clicked;
onmouseup="this.disabled=true;doSubmit('IMPORT');"

Javascript: setfocus

    apex.item("P38_RCPT_AMOUNT").setFocus();

Printing ???

Local printer:
run DO_PRINT.BAT (copy printing_data.txt com1) This is

Network printer:
Use the net.exe command to establish a persistent connection. To do this, use the following syntax at a command prompt
net use lptx \\printserver\sharename /persistent:yes
where x is the number of the printer port that you want to map, where printserver is the print server that is sharing the printer, and where sharename is the name of the printer share.

Reading from web page

response = utl_http.request(url);



Flash Map

GIS applications

Apex Maps


https://community.oracle.com/thread/3733045?start=0&tstart=0

converting mapinfo files.

Converting Vector graphics into swf.

Steps:

Get the vector graphics file


Read into Adobe Illustrator


Get flash catalyst to convert into Swf file


Convert it to .amap file to publich in Apex Anymap.



jQuery tabs within Oracle APEX



Google map in  Oracle APEX




get screen resolution with Javascript

https://andylangton.co.uk/blog/development/get-viewportwindow-size-width-and-height-javascript
If you are using jQuery, you can get the size of the window or the document using jQuery methods:
$(window).height();   // returns height of browser viewport
$(document).height(); // returns height of HTML document
$(window).width();   // returns width of browser viewport
$(document).width(); // returns width of HTML document
For screen size you can use the screen object in the following way:
screen.height;
screen.width;
var w = window,
    d = document,
    e = d.documentElement,
    g = d.getElementsByTagName('body')[0],
    x = w.innerWidth || e.clientWidth || g.clientWidth,
    y = w.innerHeight|| e.clientHeight|| g.clientHeight;
alert(x + ' × ' + y);
var width = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;

var height = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
alert(window.screen.availWidth);
alert(window.screen.availHeight);
function wndsize(){
var w = 0;var h = 0;
//IE
if(!window.innerWidth){
    if(!(document.documentElement.clientWidth == 0)){
        //strict mode
        w = document.documentElement.clientWidth;h = document.documentElement.clientHeight;
    } else{
        //quirks mode
        w = document.body.clientWidth;h = document.body.clientHeight;
    }
} else {
    //w3c
    w = window.innerWidth;h = window.innerHeight;
}
return {width:w,height:h};
}
function wndcent(){
var hWnd = (arguments[0] != null) ? arguments[0] : {width:0,height:0};
var _x = 0;var _y = 0;var offsetX = 0;var offsetY = 0;
//IE
if(!window.pageYOffset){
//strict mode
if(!(document.documentElement.scrollTop == 0)){offsetY = document.documentElement.scrollTop;offsetX = document.documentElement.scrollLeft;}
//quirks mode
else{offsetY = document.body.scrollTop;offsetX = document.body.scrollLeft;}}
//w3c
else{offsetX = window.pageXOffset;offsetY = window.pageYOffset;}_x = ((wndsize().width-hWnd.width)/2)+offsetX;_y = ((wndsize().height-hWnd.height)/2)+offsetY;
return{x:_x,y:_y};
}
var center = wndcent({width:350,height:350});
document.write(center.x+';<br>');
document.write(center.y+';<br>');
document.write('<DIV align="center" id="rich_ad" style="Z-INDEX: 10; left:'+center.x+'px;WIDTH: 350px; POSITION: absolute; TOP: '+center.y+'px; HEIGHT: 350px"><!--К сожалению, у Вас не установлен flash плеер.--></div>');

menu style effect

apple style menu:

Autologon

Pop-up when hovering over tabular column

pop-up when hovering over tabular column.
Create Javascript functions as follows. The description of each function is self-explanatory in its name.
<script language="JavaScript" type="text/javascript">
<!--
function findPosX(obj)  // Get full right offset
{
   var curleft = 0;
   if (obj.offsetParent) {
      while (obj.offsetParent) {
          curleft += obj.offsetLeft
                  obj = obj.offsetParent;
      }
   }
   else if (obj.x)
      curleft += obj.x;

   return curleft;
}

function findPosY(obj)  // Get full top offset
{
   var curtop = 0;
   if (obj.offsetParent) {
       while (obj.offsetParent) {
           curtop += obj.offsetTop
           obj = obj.offsetParent;
       }
   }
   else if (obj.y)
       curtop += obj.y;

   return curtop;
}

function ShowPopup(hv_item)
{
   var t1;  // First part of Text formatting
   var t2;  // Latter part of Text formatting
   dp = document.getElementById("DisplayPopup");

   t1 = "<table><tr><td width=200 align='center' bgcolor='gray'><font color='white'>";
   t2 = "</font></td></tr></table>";
  
   dp.innerHTML = t1 + hv_item.value + t2;

   // Set position of hover-over popup
   dp.style.top = findPosY(hv_item) - 10;
   dp.style.left = findPosX(hv_item) + 20;

   // Set popup to visible
   dp.style.visibility = "Visible";
}

function HidePopup()
{
   dp = document.getElementById("DisplayPopup");
   dp.style.visibility = "Hidden";
}
//-->

</script>

<DIV ID="DisplayPopup" style="visibility:hidden; position:absolute;"></DIV>
Please note that it includes a DIV tag named DisplayPopup which will be used to populate popup text.
You can personalize the popup in the ShowPopup function. This includes font's color, background color, popup width as well as X-Y offset position.
2. Add the following Javascript events to the Element Attributes of the column you want to have popup shown.
In my sample, I added the following Javascript events to both Ename and Job columns.
onMouseOver="ShowPopup(this);" onMouseOut="HidePopup();"


Dock type menu (Fisheye Menu)  - html


Tested OK:
Execute when page load
$(document).ready(
                function()
                {
                                $('#dock').Fisheye(
                                {
                                                maxWidth: 60,
                                                items: 'a',
                                                itemsText: 'span',
                                                container: '.dock-container2',
                                                itemWidth: 90,
                                                proximity: 90,
                                                halign : 'center'
                                })
        }
);

Tarmis : from pl/sql
In pl/sql anonymous block, source
declare
 c_line varchar2(4000);
begin
 c_line :=  tm_menu.main_menu(:G_ME);
 htp.p (c_line);
end;
region header
<script type="text/javascript" src="#IMAGE_PREFIX#themes/datec/js/jquery.js"></script>
<script type="text/javascript" src="#IMAGE_PREFIX#themes/datec/js/interface.js"></script>
<style type="text/css" media="all">
*
{
                margin: 0;
                padding: 0;
}
body
{
                background: #fff;
                height: 100%;
                font-family: Arial, Helvetica, sans-serif;
                font-size: 12px;
}
</style>

html Code:
<div class="dock" id="dock">
  <div class="dock-container">
   <a class="dock-item" href="javascript:pg(0);"><img src="#IMAGE_PREFIX#themes/datec/fisheye/images/home.png" alt="home" /><span>Home</span></a>
   <a class="dock-item" href="javascript:pg(1);"><img src="#IMAGE_PREFIX#themes/datec/fisheye/images/company1.png" alt="customers" /><span>Customers</span></a>
   <a class="dock-item" href="javascript:pg(18);"><img src="#IMAGE_PREFIX#themes/datec/fisheye/images/client1.png" alt="portfolio" /><span>Contacts</span></a>
   <a class="dock-item" href="javascript:pg(21);"><img src="#IMAGE_PREFIX#themes/datec/fisheye/images/activities1.png" alt="music" /><span>Activities</span></a>
   <a class="dock-item" href="javascript:pg(56);"><img src="#IMAGE_PREFIX#themes/datec/fisheye/images/quote1.png" alt="video" /><span>Quotations</span></a>
   <a class="dock-item" href="javascript:pg(34);"><img src="#IMAGE_PREFIX#themes/datec/fisheye/images/opportunity1.png" alt="Opportunities" /><span>Opportunities</span></a>
   <a class="dock-item" href="javascript:pg(71);"><img src="#IMAGE_PREFIX#themes/datec/fisheye/images/license1.png" alt="calendar" /><span>Software Licenses</span></a>
   <a class="dock-item" href="javascript:pg(75);"><img src="#IMAGE_PREFIX#themes/datec/fisheye/images/project1.png" alt="rss" /><span>Customer Projects</span></a>
  </div>
</div>
------????
Javascript for calling page
function pg(i)
{
 if (i == 1)
 {
  var msg = '<b>National Capital District Commission</b>';
  var $dialog = $('<div data-role="popup" id="myPopup">  <p>'+msg+'</p></div>');
  $($dialog).dialog({
        show: {effect: "slideUp", duration: 1000},
        hide: {effect: "SlideDown",duration: 1000},
        open: function(event, ui){
            $(".ui-dialog-titlebar-close").hide(); },
        modal: true ,
        dialogClass: 'noTitle',
        title: 'TARMIS' ,
        width : 100 ,
        height: 100,
        resizable: false,
        minWidth: 100,
        position: 'top',
        buttons: {
            "Close": function(){$(this).dialog("close");}
         },closeOnEscape: true });
 }else{
   var url = 'f?p=&APP_ID.:'+i+':&SESSION.::NO:::';
   redirect(url);
 }
}

Define CSS:
/* added for fisheye */
/*
 body {
        font: 11px Arial, Helvetica, sans-serif;
        background: #ffffff url(/i/themes/datec/fisheye/images/main-bg.gif);
        padding: 0;
        margin: 0;
}
img {
        border: none;
}
*/
/* dock - top */
.dock {
        position: relative;
        height: 50px;
        text-align: center;
}
.dock-container {
        position: absolute;
        height: 50px;
        background: url(/i/themes/datec/fisheye/images/dock-bg.gif);
        padding-left: 20px;
}
.dock-containery {
        position: absolute;
        height: 50px;
        background: url(/i/themes/datec/fisheye/images/dock-bgy.gif);
        padding-left: 20px;
}
.dock-item {
        display: block;
        width: 40px;
        color: #000;
        position: absolute;
        top: 0px;
        text-align: center;
        text-decoration: none;
        font: bold 12px Arial, Helvetica, sans-serif;
}
.dock-item img {
        border: none;
        margin: 5px 10px 0px;
        width: 100%;
}
.dock-item span {
        display: none;
        padding-left: 20px;
}
/* dock2 - bottom */
.dock2 {
        width: 100%;
        bottom: 0px;
        position: absolute;
        left: 0px;
}
.dock-container2 {
        position: absolute;
        height: 50px;
        background: url(/i/themes/datec/fisheye/images/dock-bgy.gif);
        padding-left: 20px;
}
.dock-item2 {
        display: block;
        font: bold 12px Arial, Helvetica, sans-serif;
        width: 40px;
        color: #000;
        bottom: 0px;
        position: absolute;
        text-align: center;
        text-decoration: none;
}
.dock-item2 span {
        display: none;
        padding-left: 20px;
}
.dock-item2 img {
        border: none;
        margin: 5px 10px 0px;
        width: 100%;
}
/*---fish eye end --*/

Apex samples


Problem Screen sending


javascript:getScreen();

function getScreen() {
  if (!!document.createElement("canvas").getContext) {
    html2canvas(window.document.body, {
      onrendered: function(canvas) {
      var dataUrl = canvas.toDataURL("image/jpeg");
      var clobObj = new apex.ajax.clob(
        function(p){
          if (p.readyState == 4){
            var get = new htmldb_Get(null,$v('pFlowId')
                     ,'APPLICATION_PROCESS=mailScreen',0);
            gReturn = get.get();
            alert('Mail has been send');
          }
        });
        clobObj._set(dataUrl );     
      }
    });
  } else {
    var get = new htmldb_Get(null,$v('pFlowId')
              ,'APPLICATION_PROCESS=mailScreen',0);
    gReturn = get.get();
    alert('Mail has been send');
  } 
}
Supposed to send email. Chk url for full code.

Tooltip Hoover Effect

http://creativeindividual.co.uk/2011/02/create-a-pop-up-div-in-jquery/

Set Column width in Report

Edit the column and under CSS Style enter something like:

display:block;width:400px;overflow:hidden
Option 2:
report -> region header ->
<style type="text/css">
.fixed {display:block; width:50px; overflow-x: scroll; background-color: #FFFFCC;}
</style>


then go to the column you'd like to fix, find the section "Column Link" and put
class=fixed
into the Link Attributes field.

Global Variables Available in APEX_APPLICATION

Table 1-1 Global Variables Available in APEX_APPLICATION
https://docs.oracle.com/html/E28475_02/apex_app.htm
Global Variable
Description
G_USER
Specifies the currently logged in user.
G_FLOW_ID
Specifies the ID of the currently running application.
G_FLOW_STEP_ID
Specifies the ID of the currently running page.
G_FLOW_OWNER
Specifies the schema to parse for the currently running application.
G_REQUEST
Specifies the value of the request variable most recently passed to or set within the show or accept modules.
G_BROWSER_LANGUAGE
Refers to the Web browser's current language preference.
G_DEBUG
Refers to whether debugging is currently switched on or off. Valid values for the DEBUG flag are 'Yes' or 'No'. Turning debug on shows details about application processing.
G_HOME_LINK
Refers to the home page of an application. The Application Express engine will redirect to this location if no page is given and if no alternative page is dictated by the authentication scheme's logic.
G_LOGIN_URL
Can be used to display a link to a login page for users that are not currently logged in.
G_IMAGE_PREFIX
Refers to the virtual path the web server uses to point to the images directory distributed with Oracle Application Express.
G_FLOW_SCHEMA_OWNER
Refers to the owner of the Application Express schema.
G_PRINTER_FRIENDLY
Refers to whether or not the Application Express engine is running in print view mode. This setting can be referenced in conditions to eliminate elements not desired in a printed document from a page.
G_PROXY_SERVER
Refers to the application attribute 'Proxy Server'.
G_SYSDATE
Refers to the current date on the database server. this uses the DATE DATATYPE.
G_PUBLIC_USER
Refers to the Oracle schema used to connect to the database through the database access descriptor (DAD).
G_GLOBAL_NOTIFICATION
Specifies the application's global notification attribute.

select owner, trim(text)
from dba_source
where name = 'WWV_FLOW'
and type = 'PACKAGE'
and ltrim(text) like 'g%'
order by owner desc, line;

v('APP_USER')    = APEX_APPLICATION.g_user
v('REQUEST')     = APEX_APPLICATION.g_request
v('APP_ID')      = APEX_APPLICATION.g_flow_id
v('APP_PAGE_ID') = APEX_APPLICATION.g_flow_step_id
v('DEBUG')       = APEX_APPLICATION.g_debug
apex_application_global.g_image_prefix

function call                    |  result
---------------------------------|-----------------------------------
APEX_UTIL.HOST_URL()             |  http://example.com:5883
APEX_UTIL.HOST_URL('SCRIPT')     |  http://example.com:5883/pls/apex/
APEX_UTIL.HOST_URL('IMGPRE')     |  http://example.com:5883/i/

l_cgi_var_name      varchar2(100) := 'SERVER_NAME'; 
l_server_name varchar2(2000) := owa_util.get_cgi_env(l_cgi_var_name) ;

Subsititution Variables
APEX$ROW_NUM
APEX$ROW_SELECTOR
APEX$ROW_STATUS
APP_ID
APP_ALIAS
APP_DATE_TIME_FORMAT
APP_IMAGES
APP_NLS_DATE_FORMAT
APP_NLS_TIMESTAMP_FORMAT
APP_NLS_TIMESTAMP_TZ_FORMAT
APP_IMAGES
APP_PAGE_ID
APP_SESSION
APP_SESSION_VISIBLE
APP_UNIQUE_PAGE_ID
APP_USER
AUTHENTICATED_URL_PREFIX
BROWSER_LANGUAGE
CURRENT_PARENT_TAB_TEXT
DEBUG
HOME_LINK
IMAGE_PREFIX
LOGIN_URL
LOGOUT_URL
PRINTER_FRIENDLY
PROXY_SERVER
PUBLIC_URL_PREFIX
REQUEST
SCHEMA OWNER
SQLERRM
SYSDATE_YYYYMMDD
WORKSPACE_IMAGES

Apex checkbox


SELECT apex_item.checkbox (1,
                           empno,
                           'onchange="spCheckChange(this);"',
                           :f_empno_list,
                           ':'
                          ) checkbox,
       empno, ename, job
  FROM emp

Report Progress Bar

Option 1:
http://stackoverflow.com/questions/32716566/oracle-apex-create-a-progress-bar-when-waiting-result
Here is the easiest solution with no javascript or css.
Lets say you have a button named 'P1_Submit' which submits the page and triggers you process. Edit the button and at Action select Defined by Dynamic Action. Then create a dynamic action with:
Event=Click
Selection Type=Button
Button=P1_Submit
Condition=No Condition
True Action=Submit Page
Uncheck Fire On Page Load
Show Processing=Yes

Displaying Percentage Bar in APEX Reports

1- Create your report
In this report we're using the employees percentage of salary within their department

SELECT e.ename,
       e.job,
       d.dname,
       e.sal,
       ROUND (e.sal / SUM (e.sal) OVER (PARTITION BY e.deptno) * 100, 0) pct_dep_sal,
       ROUND (e.sal / SUM (e.sal) OVER (PARTITION BY e.deptno) * 100, 0) bar
  FROM emp e,
       dept d
 WHERE e.deptno = d.deptno


2- Add Percentage Bar for the "bar" column
- In the Reports Attributes section, click on the "Bar" column attributes
- Under Number/Date formatting enter the following: PCT_GRAPH:330099:CC0000:100

PCT_GRAPH:<Hex background color>:<Hex foreground color>:<Bar width in pixels>

Some Overlay features




Fixed height html cells

Boxh
<style>
td.container > div { width: 100%; height: 100%; overflow:hidden; }
td.container { height: 200px; }
</style>
<br><br>
<table align="center" style="border:1px solid yellowgreen;border-collapse:collapse;">
<tr><td>
Boxr1c1
Html Region header
<tr><td>
<table width="400" align="center" border="1"><tr><td style="text-align: center; background-color: #6699ff" ><B>Box 1</B></td></tr>
<tr><td class="container">

Html Region footer
</td></tr></table>

Boxr1c2
Html Region header
</td><td>
<table width="400" align="center" border="1"><tr><td style="text-align: center; background-color: #6699ff"><B>Box 2</B></td></tr>
<tr><td class="container">
Html Region footer
</td></tr></table>
Boxr1c3
Html Region header
</td><td>
<table width="400" align="center" border="1"><tr><td style="text-align: center; background-color: #6699ff"><B>Box 3</B></td></tr>
<tr><td class="container">
Html Region footer
</td></tr>
</td></tr></table>
Boxr2c1
Html Region header
<tr><td>
<table width="400" align="center" border="1"><tr><td style="text-align: center; background-color: #6699ff" ><B>Box 4</B></td></tr>
<tr><td class="container">
Html Region footer
</td></tr></table>
Boxr2c2
Html Region header
</td><td>
<table width="400" align="center" border="1"><tr><td style="text-align: center; background-color: #6699ff"><B>Box 5</B></td></tr>
<tr><td class="container">
Html Region footer
</td></tr></table>
Boxr2c3
Html Region header
</td><td>
<table width="400" align="center" border="1"><tr><td style="text-align: center; background-color: #6699ff"><B>Box 6</B></td></tr>
<tr><td class="container">
Html Region footer
</td></tr>
</td></tr></table>

Boxf
Html Region footer
</td></tr></table>


Java Applet on browser


Download java
http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
jre-8u66-windows-x64.exe

java prog:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.net.*;

public class WelcomeApplet extends javax.swing.JApplet
{
  public void init()
  {
     Container contentPane = getContentPane();
     contentPane.setLayout (new BorderLayout());

     JLabel label = new JLabel (getParameter("greeting"),
                    SwingConstants.CENTER);
     label.setFont (new Font("TimesRoman", Font.BOLD, 18));
     contentPane.add(label, "Center");
     JPanel panel = new JPanel();

     JButton cayButton = new JButton("Softdev Server");
    //cayButton.addActionListener(getURLActionListener ("http://softdev"));
     panel.add(cayButton);
   
     JButton garyButton = new JButton("Kishor Sinha");
   //  garyButton.addActionListener(getURLActionListener
   //  ("mailto:ksinha@datec.com.pg"));
     panel.add(garyButton);
     contentPane.add(panel, "South");
  }
  public ActionListener getULActionListener(final String urlString)
  {
    return new ActionListener()
    {
      public void actionPerformed(ActionEvent evt)
      {
        try
        {
          URL u = new URL(urlString);
          getAppletContext().showDocument (u);
        }
        catch(Exception e) {e.printStackTrace(); }
      }
  };
 }
}
HTML Code
<head><title>Product by KishTech</title></head>
<body>
<APPLET code=WelcomeApplet.class width=800 height=200 >
<PARAM name=greeting value="Tax and Rates Management & Information System">
</APPLET>
</body>
</html>

Compile java
javac WelcomeApplet.java

Test on client
appletviewer Welcome.html

               
Install Java in Internet Explorer


ExpandCollapse
Internet Explorer opened from the Start screen is designed to provide an add–on free experience. Add–ons, like Java, will only work in Internet Explorer for the desktop. Learn more about add–ons and Internet Explorer
To install Java for Internet Explorer in the desktop
Open the desktop, and then tap or click the Internet Explorer icon on the taskbar.
Go to Java.com.
Tap or click the Free Java Download button, and then tap or click Agree and Start Free Download. If you're prompted for an administrator password or confirmation, enter the password or provide confirmation.
On the notification bar, tap or click Run. If you're prompted for an administrator password or confirmation, enter the password or provide confirmation.
Tap or click Install and then tap or click Close.
If you're having problems installing or using Java, look for answers in the Java Help Center.
Note
In Windows RT, Java and other add-ons aren't supported by Internet Explorer or Internet Explorer in the desktop.


ExpandCollapse
To install Java
Open Internet Explorer by clicking the Internet Explorer icon on the taskbar.
Go to Java.com.
Click the Free Java Download button, and then click Agree and Start Free Download. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
On the notification bar, click Run. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
Click Install and then click Close.
To uninstall older versions of Java
Open Programs and Features by clicking Start, then clicking Control Panel, clicking Programs, and then clicking Programs and Features.
Select Java from the list, and then click Uninstall. You might be prompted for an administrator password or confirmation.
If you're having problems installing or using Java, look for answers in the Java Help Center.


ExpandCollapse
Internet Explorer 10 is designed to provide an add-on free experience. Add-ons, like Java, will only work in Internet Explorer for the desktop.
To install Java in Internet Explorer for the desktop
Open Internet Explorer for the desktop.
Go to Java.com.
Tap or click the Free Java Download button, and then tap or click Agree and Start Free Download. If you're prompted for an administrator password or confirmation, enter the password or provide confirmation.
On the Notification bar, tap or click Run. If you're prompted for an administrator password or confirmation, enter the password or provide confirmation.
Tap or click Install and then tap or click Close.
To uninstall older versions of Java
Swipe in from the right edge of the screen (if you're using a mouse, point to the upper-right corner of the screen and move the mouse pointer down), tap or click Search, enter Control panel in the search box, tap or click Apps, and then tap or click Control Panel.
Tap or click Programs, and then tap or click Uninstall a program.
Select Java from the list of apps, and then tap or click Uninstall. You might be prompted for an administrator password or confirmation.
If you're having problems installing or using Java, look for answers in the Java Help Center.


ExpandCollapse
To install Java
Open Internet Explorer.
Go to Java.com.
Click the Free Java Download button, and then click Agree and Start Free Download. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
On the Notification bar, click Run. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
Click Install and then click Close.
To uninstall older versions of Java
Open Programs and Features by clicking Start, then clicking Control Panel, clicking Programs, and then clicking Programs and Features.
Select Java from the list, and then click Uninstall. You might be prompted for an administrator password or confirmation.
If you're having problems installing or using Java, look for answers in the Java Help Center.


ExpandCollapse
To install Java
Open Internet Explorer.
Go to Java.com.
Click the Free Java Download button, and then click Agree and Start Free Download. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
On the Notification bar, click Run. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
Click Install and then click Close.
To uninstall older versions of Java
Open Programs and Features by clicking Start, then clicking Control Panel, clicking Programs, and then clicking Programs and Features.
Select Java from the list, and then click Uninstall. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
If you're having problems installing or using Java, look for answers in the Java Help Center.


ExpandCollapse
To install Java
Open Internet Explorer.
Go to Java.com.
Click the Free Java Download button, and then click Agree and Start Free Download. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
If a yellow Information bar appears, click the yellow bar and then click Install ActiveX control or Install add-on.
On the Notification bar, click Run. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
Click Install and then click Close.
To uninstall older versions of Java
Open Programs and Features by clicking Start, then clicking Control Panel, clicking Programs, and then clicking Programs and Features.
Select Java from the list, and then click Uninstall. If you're prompted for an administrator password or confirmation, type the password or provide confirmation.
If you're having problems installing or using Java, look for answers in the Java Help Center.





Node.js – access oracle db from javascript



windows:


Installation


hide javascript from view source

http://www.sitepoint.com/hide-jquery-source-code/
function unloadJS(scriptName) {
  var head = document.getElementsByTagName('head').item(0);
  var js = document.getElementById(scriptName);
  js.parentNode.removeChild(js);
}

function unloadAllJS() {
  var jsArray = new Array();
  jsArray = document.getElementsByTagName('script');
  for (i = 0; i < jsArray.length; i++){
    if (jsArray[i].id){
      unloadJS(jsArray[i].id)
    }else{
      jsArray[i].parentNode.removeChild(jsArray[i]);
    }
  }      
}
Put your javascript in an external javascript file that is included with:
<script type="text/javascript" src="http://mydomain.com/xxxx.js"></script>

Tooltip in Report

Edit your column -> Column formatting
HTML Expression :
<span onmouseover="toolTip_enable(event,this,'#TOOLTIP_COLUMN#');">#COL1#</span>

Or
In grid layout -> Custom_attributes
title="Select Customer Account Number"

Or
select empno,
'<div onmouseover="toolTip_enable(event,this,''Job Position: '||job||''')">'||ename||'</div>' ename_tooltip
from emp

<span onclick="javascript:log(#ID#);" onmouseover="toolTip_enable(event,this,'Click to View Log Data');">#LOGNO#</span>

Report with images display


select p.product_id,
       p.product_name,
       p.product_description,
       p.category,
       decode(p.product_avail, 'Y','Yes','N','No') product_avail,
       p.list_price,
       (select sum(quantity) from demo_order_items where product_id = p.product_id) units,
       (select sum(quantity * p.list_price) from demo_order_items where product_id = p.product_id) sales,      
       (select count(o.customer_id) from demo_orders o, demo_order_items t where o.order_id = t.order_id and t.product_id = p.product_id group by p.product_id) customers,
       (select max(o.order_timestamp) od from demo_orders o, demo_order_items i where o.order_id = i.order_id and i.product_id = p.product_id) last_date_sold,
       p.product_id img,
'f?p='||:app_id||':6:'||:app_session||'::::P6_PRODUCT_ID:'||p.product_id icon_link,
decode(nvl(dbms_lob.getlength(p.product_image),0),0,null,
    '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '||
    'src="'||
    apex_util.get_blob_file_src('P6_PRODUCT_IMAGE',p.product_id)||
    '" height="75" width="75" alt="Product Image" title="Product Image" />')
    detail_img,
decode(nvl(dbms_lob.getlength(p.product_image),0),0,null,
    apex_util.get_blob_file_src('P6_PRODUCT_IMAGE',p.product_id))
    detail_img_no_style
from demo_product_info p

select oi.order_item_id,
       oi.order_id,
       oi.product_id,
       oi.unit_price,
       oi.quantity,
       (oi.unit_price * oi.quantity) extended_price,  
       dbms_lob.getlength(product_image) product_image ,
decode(nvl(dbms_lob.getlength(pi.product_image),0),0,null,
    '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '||
    'src="'||
    apex_util.get_blob_file_src('P6_PRODUCT_IMAGE',pi.product_id)||
    '" height="75" width="75" alt="Product Image" title="Product Image" />')
    detail_img
from DEMO_ORDER_ITEMS oi, DEMO_PRODUCT_INFO pi
where oi.ORDER_ID = :P29_ORDER_ID
and oi.product_id = pi.product_id (+)


radio button layout

execute javascript from tabular form:

To return multiple values into a Display Only fields:

1 - On this page, there are five items:

P13_EMPNO - a normal Popup LOV using:
SELECT ENAME d, EMPNO r FROM EMP ORDER BY 1
P13_ENAME - a Text item

P13_ENAME_DISPLAY - a Display as Text (escape special characters) item. Begin On New Line has been set to No so it is next to P13_EMPNO

P13_JOB - a Text item

P13_JOB_DISPLAY - a Display as Text (escape special characters) item. Begin On New Line has been set to No so it is next to P13_ENAME

2 - In the page definition, add the following into the Execute when Page Loads setting:
$(document).ready(function() {
$("#P13_EMPNO").bind("change", function()
{
 getEmployeeInfo($("#P13_EMPNO_HIDDENVALUE").val());
});
});
3 - In the page definition, add the following into the HTML Header setting:
<script type="text/javascript">
function getEmployeeInfo(filter)
{
 var xml = null;
 var get = new htmldb_Get(null,$v('pFlowId'), 'APPLICATION_PROCESS=GET_EMPLOYEE_INFO',13);
 get.add('G_EMPNO', filter);
 ret = get.get('XML');
 if(ret)
 {
  var enameItems = ret.getElementsByTagName("ENAME");
  if (enameItems)
  {
   var ename = document.getElementById("P13_ENAME");
   var enamedisplay = document.getElementById("P13_ENAME_DISPLAY");
   ename.value = enameItems[0].getAttribute("VALUE");
   enamedisplay.innerHTML = enameItems[0].getAttribute("VALUE");
  }
  var jobItems = ret.getElementsByTagName("JOB");
  if (jobItems)
  {
   var job = document.getElementById("P13_JOB");
   var jobdisplay = document.getElementById("P13_JOB_DISPLAY");
   job.value = jobItems[0].getAttribute("VALUE");
   jobdisplay.innerHTML = jobItems[0].getAttribute("VALUE");
  }
 }
 get = null;
}
</script>
This is the Ajax call triggered by the change in the select list

4 - In the application's Shared Components, create a new Application Item called G_EMPNO

5 - In the application's Shared Components, create a new On Demand Application Process called GET_EMPLOYEE_INFO, using the following code:
DECLARE
 vENAME VARCHAR2(100);
 vJOB VARCHAR2(100);
BEGIN
 owa_util.mime_header('text/xml', FALSE );
 htp.p('Cache-Control: no-cache');
 htp.p('Pragma: no-cache');
 owa_util.http_header_close;
 htp.prn('<DATA>');
 SELECT ENAME, JOB INTO vENAME, vJOB FROM EMP WHERE EMPNO = :G_EMPNO;
 htp.prn('<ENAME VALUE="' || vENAME || '"></ENAME>');
 htp.prn('<JOB VALUE="' || vJOB || '"></JOB>');
 htp.prn('</DATA>');
EXCEPTION WHEN OTHERS THEN
 htp.prn('<ENAME VALUE="No such employee!"></ENAME>');
 htp.prn('<JOB VALUE="No such employee!"></JOB>');
END;
6 - Run the page and select any value in the list. The employee's name and job should appear


Limit lenth of text field and case conversion

<script type="text/javascript">
function LimitLenght(p_obj)
{
   var obj_text = p_obj.value;

   if (obj_text.length > 5) {
       return obj_text.substr(0,5);
   }
   return obj_text;
}
</script>

"Element Attributes" under Report Attributes.
onkeyup="this.value=LimitLenght(this) onblur="this.value=this.value.toUpperCase();"

onKeyUp="this.value=this.value.toUpperCase();"; class="red";
               


Identify Column ID of Tabular Form


To identify the column ID of the tabular form, just simply use this javascript event on the Element Attributes of the needed columns.
onmouseover="alert(this.id);"
You can definitely choose a different Javascript event you're comfortable with.
This tip is useful especially when column order has been moved up/down or when some are not shown.
Sample here:
Ename: f02
Mgr: f04
Job: f03
Comm: f07
Sal: f06
Deptno: f08
Don't forget to remove it when it no longer in use. :-)

Identify Column ID of Tabular Form


1. Disable Input Element
$('input[name="f05"]').attr('disabled', 'disabled');
2. Hide Datepicker Icon
$('.ui-datepicker-trigger').hide();
3. Remove Datepicker Icon Click
$('.ui-datepicker-trigger').unbind('click');
4. "Disable" Datepicker Icon
$('.ui-datepicker-trigger').attr('disabled', 'disabled').css('opacity',0.5);
5. Report Link is
f?p=&APP_ID.:296:&SESSION.::NO:::#
6. Report Link properties are
id="link" name="#EMPNO#"
7. Dynamic Action triggers on click of jQuery Selector a#link and runs the following code
alert(this.triggeringElement.name)


Page Load time

Just simply put the keyword #TIMING# at the footer of the region. For example:
Load time: #TIMING# second(s).

Export to XML

http://docs.oracle.com/cd/E11882_01/appdev.112/e23094/xdb13gen.htm#ADXDB4994
DECLARE
   file_desc_array   xmlsequencetype := xmlsequencetype();
  file_desc_xml     clob;
   prolog1           clob := '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
  prolog2           clob := '<?xml version="1.0" encoding="UTF-8"?>';
 BEGIN
   for r in (
      select xmlserialize(document
               xmlelement("EMP_INFO"
               , xmlattributes('http://www.w3.org/2001/XMLSchema-instance' as "xmlns:xsi")
               , xmlagg(
                   xmlelement("EMP"
                   , xmlelement("ID_NO", e.employee_id)
                   , xmlelement("EMPLOYEE_NAME", e.last_name)
                   )
                 )
               )
             ) as xmldoc
           --< generating summary record :
           , xmlelement("File"
             , xmlelement("FileName"
               , 'file' || to_char(trunc((rownum-1)/100)+1, 'fm0999') || '.xml'
               )
             , xmlelement("CountOfRecords", count(*))
             ) as file_desc
           -->
           , 'file' || to_char(trunc((rownum-1)/100)+1, 'fm0999') || '.xml' as filename
      from hr.employees e
      group by trunc((rownum-1)/100)
  )
  loop
 
      dbms_xslprocessor.clob2file(prolog1 || r.xmldoc, 'TEST_DIR', r.filename, nls_charset_id('AL32UTF8'));
 
      file_desc_array.extend;
      file_desc_array(file_desc_array.last) := r.file_desc;
 
  end loop;
 
  select xmlserialize(document
           xmlelement("Files", xmlagg(column_value))
         )
  into file_desc_xml
  from table(file_desc_array) ;
 
  dbms_xslprocessor.clob2file(prolog2 || file_desc_xml, 'TEST_DIR', 'summary.xml', nls_charset_id('AL32UTF8'));
 
END;
/
SELECT XMLElement("Employee",
       XMLAttributes('http://www.w3.org/2001/XMLSchema' AS
             "xmlns:xsi",
              'http://www.oracle.com/Employee.xsd' AS
               "xsi:nonamespaceSchemaLocation"),
       XMLForest(emp_id, emp_last_name, emp_sex)) AS "RESULT"
FROM hris.hr_employees


Warn user before closing browser



Add a floating div tool bar that appears on all pages in your apex application and add buttons, items and images... onto the tool bar.
Create new region template as a floating div as shown below
Go to shared components > Templates > create
<div id=”#REGION_STATIC_ID#” #REGION_ATTRIBUTES#>
  <div id=”floatdiv”>
    #BODY#
   </div>
</div>
http://apex.oracle.com/pls/apex/wwv_flow_file_mgr.get_file?p_security_group_id=5045060016611856930&p_fname=float_div.jpg
Then go to page 0 and create a region using newly added floating region template and give it a REGION_STATIC_ID example: floatdiv

Add the below css code for id floatdiv as shown below
<style>
#floatdiv {
position:fixed;
    top:95%;
    z-index:4000;
    height:35px;
    width:100%;
    background-color:#6C6C6C;
    border-style:solid;
    border-width:1px;
    border-color:#191919;
    align:center:
    valign:center:
    text-align:center:
   }
</style>






Textfields with clear option

Add this bit of code to your html header of the page


$("document").ready(function() {
$(':text').each(function(index) {
  // Build anchor tag for clear
   var clrLink = ' <a href="javascript:clearVal(\'' + $(this).attr("id") + '\');" class="clr">
<img src="/i/menu/inline_error_16x16.gif" alt="Clear" title="Clear"></a>';
  // Add it after the text items
   $(this).after(clrLink);
  });
});

function clearVal(pId)
{
  $s(pId,'');
  // Do whatever you want here ...
}

SQL to JSON

function sql2json()
{
var get = new htmldb_Get(null,html_GetElement('pFlowId').value, 'APPLICATION_PROCESS=sql2json',0);
get.add('TEMP_ITEM',$v('P4_SQL'));
gReturn = get.get();
var vJson = $u_eval('(' + gReturn + ')');
var vtable = '<tr><th class="header">Column 1</th><th class="header">Column 2</th>
<th class="header">Column 3</th><th class="header">Column 4</th><th class="header">Column 5</th></tr>';
var valt;
for (var i=0,cnt=vJson.row.length;i<cnt;i++)
{
if (valt == 'Y')
{
vtable = vtable + '<tr><td class="dataalt">' + vJson.row[i].C1 + '</td><td class="dataalt">'
+ vJson.row[i].C2 + '</td><td class="dataalt">' + vJson.row[i].C3 + '</td><td class="dataalt">'
+ vJson.row[i].C4 + '</td><td class="dataalt">' + vJson.row[i].C5 + '</td></tr>';
valt = 'N';
}
else
{
vtable = vtable + '<tr><td class="data">' + vJson.row[i].C1 + '</td><td class="data">'
+ vJson.row[i].C2 + '</td><td class="data">' + vJson.row[i].C3 + '</td><td class="data">'
+ vJson.row[i].C4 + '</td><td class="data">' + vJson.row[i].C5 + '</td></tr>';
valt = 'Y';
}
}

vtable = '<table border="0" cellpadding="0" cellspacing="0" class="report-standard-alternatingrowcolors" summary="" >'
+ vtable + '</table>';

$('#JSONRPT').html(vtable);

Screen Save


Page flow diagram

http://www.inside-oracle-apex.com/apexlib-get-page-flow-diagram-of-your-application/

https://apex.oracle.com/pls/otn/f?p=20587:100::::::

HTML codes

Disable backspace:

Extract Report source in Page

select apr.region_id
                      , apr.region_name
                      , apr.region_source
                      , apr.source_type_code
                      , apr.report_column_source_type
                      , apr.page_name
                 from apex_application_page_regions apr
                 where apr.application_id = :t_app_id
                 and   apr.page_id = :t_page_id
                 and   apr.source_type_code in ( 'SQL_QUERY', 'DYNAMIC_QUERY', 'STRUCTURED_QUERY', 'FUNCTION_RETURNING_SQL_QUERY' )
/*
                 and   apr.region_name in ( select substr( prn, instr( ';' || prn, ';', 1, level ), instr( prn || ';', ';', 1, level ) - instr( ';' || prn, ';', 1, level ) )
                                            from ( select p_regionname prn from dual )
                                            connect by level <= length( prn ) - nvl( length( replace( prn, ';' ) ), 0 ) + 1
                                            union all
                                            select apr.region_name
                                            from dual
                                            where p_regionname is null
                                          )
*/
                 order by apr.display_sequence

Arrow Keys

Arrow keys in Tabular Form
Set the Element Attributes of the columns of the tabular form to :

onkeyup="moveUpDown(this, event)"
and create a that function in the HTML Header:


function moveUpDown(pThis, pEvent){
  var keynum;
  var current = document.getElementsByName( pThis.name );
  if(window.event) // IE
  { keynum = pEvent.keyCode; }
  else if(pEvent.which) // Netscape/Firefox/Opera
  { keynum = pEvent.which; }
  if (keynum == 40 || keynum == 38) // Key-Up or Key-Down
  { for (i=0;i < current.length;i++)
   { if ( current[i].id == pThis.id ) // This is current row
     { if (keynum == 40) // Move down
       { current[Math.min(current.length - 1,i+1)].focus(); }
      else  // Move up
       { current[Math.max(0,i-1)].focus(); }
     }
   }
 }
}


use dynamic action.
reate an Adv Dynamic Action:
Name: Move with Arrow Keys
Event: Key Down
Selector Type: jQuery
jQuery Selector: input[id^=f]

The selector will apply to all input fields whose ID starts with f. This may need to be fine tuned or limited to only the input fields on the tabular form.

The True Action is of type Execute JavaScript Code
And here is the code:
var col = this.triggeringElement.id.split("_")[0];
var row = this.triggeringElement.id.split("_")[1];
var k = this.browserEvent.keyCode;

var new_row, moveFocus = false;

// Key Down
if (k===40) {
//  console.log('Go Down from ' + this.triggeringElement.id);
  new_row = Number(row) + 1;
  moveFocus = true;
}
else
// Key Up
if (k===38) {
  // console.log('Go Up from ' + this.triggeringElement.id);
  new_row = Number(row) - 1;
  moveFocus = true;
}

// Move the focus
if (moveFocus) {

  if (new_row < 10) {
    $("#" + col + "_000" + new_row).focus();
  }
  else {
    $("#" + col + "_00" + new_row).focus();
  }
}
Change the Event Scope to "Live" so that you don't get a bunch of key listeners all over your page. That will make it so that there's only one.

Find workspace ID

1.  select to_char(workspace_id,'99999999999999999999999')
2.  from apex_workspaces
3.  where workspace = '&WORKSPACE_NAME';

select distinct to_char(workspace_id,'9999999999999999999') id,
substr(workspace,1, 25) Workspace from  apex_applications;

ORACLEXE Images

http://daust.blogspot.com/2006/03/where-are-images-of-application.html


Error Handling in PL/SQL for Apex

         apex_error.add_error(
                     p_message => 'Error 1',
                     p_display_location => apex_error.c_inline_with_field,
                     p_page_item_name   => 'P10_FILE_ID1'
                 );

raise_application_error(sqlcode,sqlerrm);

DECLARE
   e_bad_value EXCEPTION;
BEGIN
   RAISE e_bad_value;
END;
RAISE PROGRAM_ERROR;

Contact Chips on Page

<style>
.chip {
    display: inline-block;
    padding: 0 25px;
    height: 50px;
    font-size: 16px;
    line-height: 50px;
    border-radius: 25px;
    background-color: #f1f1f1;
}

.chip img {
    float: left;
    margin: 0 10px 0 -25px;
    height: 50px;
    width: 50px;
    border-radius: 50%;
}
</style>
<div class="chip">
  <img src="#WORKSPACE_IMAGES#bpng_logo.png" alt="BPNG" >
  TEST System
</div>
--- closable
<!DOCTYPE html>
<html>
<head>
<style>
.chip {
    display: inline-block;
    padding: 0 25px;
    height: 50px;
    font-size: 18px;
    line-height: 50px;
    border-radius: 25px;
    background-color: #f1f1f1;
}

.chip img {
    float: left;
    margin: 0 10px 0 -25px;
    height: 50px;
    width: 50px;
    border-radius: 50%;
}

.closebtn {
    padding-left: 10px;
    color: #888;
    font-weight: bold;
    float: right;
    font-size: 20px;
    cursor: pointer;
}

.closebtn:hover {
    color: #000;
}
</style>
</head>
<body>

<p>Click on the "x" symbol to delete the contact.</p>

<div class="chip">
  <img src="img_avatar.png" alt="Person" width="96" height="96">
  John Doe
  <span class="closebtn" onclick="this.parentElement.style.display='none'">&times;</span>
</div>

</body>
</html>

Display pdf in pl/sql


declare
  lf_file             utl_file.file_type;
  lr_raw_data         raw(32767);
  lb_blob_data        blob;
  ln_buffer_size      binary_integer := 32767;
  ln_read_offset      integer := 1;
  ln_blob_len         integer;
 
  lh_http_request     utl_http.req;
  lh_http_response    utl_http.resp;

  lv_os_out           varchar2(2500); -- required for my  runoscommand
  ln_os_num           number := 0;  -- required for my runoscommand
  lv_path             varchar2(40) := util_get_path('UNIX'); --personal funct to get paths
  lv_pub_path         varchar2(40) := util_get_path('PUB');
 
  lv_report_url       varchar2(75) := 'http://foreg.only.com:8888/reports/rwservlet?server=reportserver'; -- eg only
  lv_report_name      varchar2(50) := 'report=repotrt_name.rdf';
  lv_desname          varchar2(50) := 'desname=/oracle/tmp/jp_rep.pdf';
  lv_dest_type        varchar2(20) := 'destype=cache';
  lv_desformat        varchar2(20) := 'desformat=pdf';
  lv_db_cred          varchar2(100) := 'userid=user/pass@schema.foregonly.com';
  lv_params           varchar2(500) := 'pn_region=2'||'&'||'pn_season_code=''12'''||'&'||'pv_username=''USERNAME''';

begin
  dbms_lob.createtemporary(lb_blob_data, false);
  lh_http_request := utl_http.begin_request(lv_report_url||'&'||
                                            lv_db_cred||'&'||
                                            lv_report_name||'&'||
                                            lv_dest_type||'&'||
                                            lv_desformat||'&'||
                                            lv_desname||'&'||
                                            lv_params);
  lh_http_response := utl_http.get_response(lh_http_request);
 
  begin 
    loop
      utl_http.read_raw(lh_http_response, lr_raw_data, ln_buffer_size);     
      dbms_lob.writeappend (lb_blob_data, utl_raw.length(lr_raw_data), lr_raw_data);     
    end loop;   
  exception 
    when utl_http.end_of_body then
      utl_http.end_response(lh_http_response);
  end;
  
  ln_blob_len := dbms_lob.getlength(lb_blob_data);
  ln_read_offset := 1;
  lf_file := utl_file.fopen(lv_path, 'test.pdf', 'wb', ln_buffer_size);
  while ln_read_offset < ln_blob_len loop
    dbms_lob.read(lb_blob_data, ln_buffer_size, ln_read_offset, lr_raw_data);   
    utl_file.put_raw(lf_file, lr_raw_data, true);   
    ln_read_offset := ln_read_offset + ln_buffer_size;
  end loop;
 
  dbms_lob.freetemporary(lb_blob_data);
  utl_file.fclose(lf_file);
  osutil.RunOsCmd('cp -f '||lv_path ||'/'||'test.pdf'||' '||lv_pub_path,lv_os_out,ln_os_num); --external pkg you could probably use utl_file.rename or copy
  osutil.RunOsCmd('rm -f '||lv_path ||'/'||'test.pdf', lv_os_out,ln_os_num);
exception
  when others then
    utl_http.end_response(lh_http_response);
    utl_file.fclose(lf_file);
    dbms_lob.freetemporary(lb_blob_data);
    dbms_output.put_line(sqlerrm);
    dbms_output.put_line(dbms_utility.format_error_backtrace);
end;
/

Run OS command from pl/sql


osutil.RunOsCmd

Filter text from PDF



create or replace directory pdf_dir as '&1';

create or replace directory l_curr_dir as '&3';

declare
  ll_clob     CLOB;
  l_bfile     BFILE;
  l_filename  VARCHAR2(200) := '&2';
begin
  begin
    ctx_ddl.drop_preference('testfilter');
    ctx_ddl.drop_policy('testdimac_policy1');
  exception when others then
    null;
  end;

  ctx_ddl.create_preference('testfilter', 'AUTO_FILTER');
  ctx_ddl.create_policy('testd_policy1', 'testfilter');

  l_bfile := bfilename('PDF_DIR', l_filename);

  dbms_lob.fileopen(l_bfile);

  ctx_doc.policy_filter(
      policy_name => 'test_policy1'
    , document    => l_bfile
    , restab      => ll_clob
    , plaintext   => true
    , CHARSET     => 'US7ASCII'
  );

DBMS_XSLPROCESSOR.clob2file (ll_clob,'L_CURR_DIR' , '&4');
/

Pop-up region


Page:
Execute when page load
$(function() {
  var moveLeft = 20;
  var moveDown = 10;

  $('a#trigger').hover(function(e) {
    $('div#pop-up').show();
      //.css('top', e.pageY + moveDown)
      //.css('left', e.pageX + moveLeft)
      //.appendTo('body');
  }, function() {
    $('div#pop-up').hide();
  });

  $('a#trigger').mousemove(function(e) {
    $("div#pop-up").css('top', e.pageY + moveDown).css('left', e.pageX + moveLeft);
  });

});

Inline:
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #000 url(bg-texture.png) repeat;
  color: #dddddd;
}

h1, h3 {
  margin: 0;
  padding: 0;
  font-weight: normal;
}

a {
  color: #EB067B;
}

div#container {
  #width: 580px;
  margin: 100px auto 0 auto;
  #padding: 20px;
  background: #000AA;
  border: 1px solid #1a1a1a;
}
/* HOVER STYLES */
div#pop-up {
  display: none;
  position: absolute;
  #width: 280px;
  #padding: 10px;
#  background: #eeeeee;
  background: lightblue;
#  background-color:#6C6C6C;
  color: #000000;
  border: 1px solid #1a1a1a;
  #font-size: 90%;
}

Define Region Header

  <div id="container">
    <h1>Student Detail</h1>
    <p>
      To show hidden div, simply hover your mouse over
      <a href="#" id="trigger">this link</a>.
    </p>

    <!-- HIDDEN / POP-UP DIV -->
    <div id="pop-up">
      <h3>Pop-up div Successfully Displayed</h3>
      <p>
        This div only appears when the trigger link is hovered over.
        Otherwise it is hidden from view.

Define Region Footer
      </p>
   </div>
  </div>

Report Column Formatting:

Update the value in item;

<span style="color:red;" onmouseover="javascript:showstud(#KEY_ID#);" onmouseover="toolTip_enable(event,this,'Click to View Detail');"><a href="#" id="trigger">#UPD_BY#</a></span>
    <div id="pop-up">
      <h3>Pop-up div Successfully Displayed</h3>
      <p>
        This div only appears when the trigger link is hovered over.
        Otherwise it is hidden from view.
      </p>
   </div>

Execute dynamic action to show the region.
begin
:P65_FNAME := css_utils.get_stud_det (:P65_CSSID, 21);
:P65_LNAME := css_utils.get_stud_det (:P65_CSSID, 22);
:P65_INAME := css_utils.get_stud_det (:P65_CSSID, 1);
:P65_CNAME := css_utils.get_stud_det (:P65_CSSID, 3);
:P65_PNAME := css_utils.get_stud_det (:P65_CSSID, 5);
end;

Data Load Service



Creating Data Load Wizard using the data loading page wizard


In this section, you use the Data Loading page wizard to create four pages in your application that enable the end-user to load data into the DEPENDENTS table. Perform the following steps:

Click Create Page >.
Click the Data Loading icon.
Enter Load Dependents for Definition Name, select the following values for the remaining fields, and click Next >.
Table Name
DEPENDENTS (table)
Unique Column 1
FIRST_NAME (Varchar2)
Unique Column 2
LAST_NAME (Varchar2)
You want to add a Transformation Rule which ensures that all the values of the GENDER column are always stored in Upper Case. Enter Uppercase Gender for Rule Name, move GENDER (Varchar2) to the selected group for Select Column(s), select To Upper Case for Type, and click Add.
The new transformation rule is created. Click Next >.
You want to create a Table Lookup such that, when you give a name for the RELATIVE_ID column in the data load file, that name is matched with ENAME in EMPtable, and the corresponding EMPNO will be stored in the RELATIVE_ID column of the DEPENDENTS table. Select the following values, and click Add.
Column Name
RELATIVE_ID (Number)

Table Name
EMP (table)

Return Column
EMPNO (Number)
Upload Column
ENAME (Varchar2)

The Table Lookup is created. Click Next >.
View Image
The details of the four pages to be created as part of the Data Load Wizard are displayed. Accept the defaults, and click Next >.
Select Identify an existing navigation menu entry for this page for Navigation Preference, Home for Existing Navigation Menu Entry, and click Next >.

Note: By selecting "Identify an existing Navigation Menu Entry for this Page" for Navigation Preference, the new page will be highlighted on an existing, top level, menu entry.

You want to branch to the Home page, if the user clicks the Cancel of Finish buttons on the Data Load Wizard. Click the List of Values icon for Cancel Button Branch to Page.
Select 1 Home.
Enter 1 for Finish Button Branch to Page, and click Next >.
Click Create.
Data Load Source page, which is the first page of the Data Load Wizard opens. Click Save and Run Page.

Using the Data Load Wizard to Load the Data from a File

In this section, you use the Data Load wizard created in the previous section, to load data into the DEPENDENTS table from a file. Perform the following steps:

In the Data Load Source step of the Data Load Wizard, select Upload file, comma separated (*.csv) or tab delimited for Import From.
Click Choose File.
Locate the dependents_data1.txt file in your working directory, and click Open. Once the dependents_data1.txt is chosen for File Name, click Next.
The next step in the Data Load Wizard is Data/Table Mapping. In this step, the tab delimited data from the file is mapped against each column name of the DEPENDENTS table. Notice that some of the values of the GENDER column are in lower case, and all the values for RELATIVE_ID are names instead of IDs. Check the data/table mapping, and click Next.
The Data Validation step of the wizard appears. All the transformation rules and table lookups are applied in this step.Notice that all the GENDER values are in upper case and the RELATIVE_ID values are replaced by corresponding EMPNObased on the table lookup created earlier. Click Load Data.

Notice that the 
RELATIVE_ID value for Pierre and CLAUDE is not replaced with the corresponding EMPNO from EMP table. This is because, a suitable match is not found for these values in the ENAME column of EMP table.
The next step in the wizard displays the Data Load Results. Notice that two records failed because no match is found for the RELATIVE_ID value in the EMP table. Click Finish.
The report displays all the records inserted into the DEPENDENTS table. You want to add a button on this page which opens the Data Load Wizard, when clicked. Click Edit Page 1 in the developer toolbar.

2 comments:

  1. This is very interesting blog and very helpful for newcomers . Thanks for sharing this great and helpful information . I am a gamer and I would like to suggest to you an auto-clicker which is really interesting . you may Visit here

    ReplyDelete
  2. Good Blog liked it very much. It is positive blog. Explain in simple and understanding language. Btw I am gamer and I have something interesting for you. You may Click Here

    ReplyDelete