Notifications

  • User Blogs

Breadcrumb

Posts

  • Refresh region of base page when closing modal dialog

    Hi,

    Here is the requirement for refreshing the report on base page,to do so i am just creating a Dynamic Action (DA) .

    Parent Page : 

    Create Dynamic action >

    Event > Dialog Closed

    Selection type > Javascript Expression

    Condition > JavaScript Expression> window

    if You are working with Apex 5.1 then 

    Client-side Condition>JavaScript Expression> window

    Type> JavaScript Expression>

    this.browserEvent != "load" && this.data.dialogPageId == "pageno"

    True Action > Refresh

    Affected Elements > Selection Type > Region

    Region> Select your region

    laugh

    Ashish kjahsjkasj Sahay: 22-DEC-16
  • Ordering & Formatting Date Columns in APEX

    Quite often I'll find I'd like to display a date with the time in a column within an APEX report, but you end up wondering how to control the wrap.

    This is one problem that probably has a half dozen solutions, but I think this is the cleanest. And blogging about it helps me remember next time.

    Depending on your screen size, you might be faced with something that takes up too much space per row.
     

    not a good wrap


    One solution is to turn that column into a formatted character string
    ,to_char(created_date,'DD-MON-YYYY"<br>"HH24:MI:SS') created_date
    Note the HTML break tag surrounded by double quotes, this will put the time on the next line.

    Combine this with styling on the column to stop wrapping.
    Column setting CSS Style: white-space:nowrap
    And you'll get a neater output.

     

    If column is varchar, won't order nice


    But there's a problem. And it's a deal breaker if you want to allow the user to order the column.
    Your output will be ordered Apr, Aug, Dec, Feb, Jan... sense a trend? Alphabetical, not chronological.
    Applying formatting within SQL is something you generally want to avoid.

    Instead, just use the funky date format mask and apply it in a declarative manner within the column attributes, along with the CSS Style. This will allow the report to honour the appropriate ordering on the date columns, whatever format mask you require.
     

    Declarative column attributes, using DD-MON-YYYY "<br>"HH24:MI:SS


    Either way you need to set "Escape special characters" to No. I think your individual date values will be safe from cross site scripting.

    These settings, along with the other Column Formatting options are used frequently in my applications, particularly HTML Expression. Just remember, if you use style frequently, define a class in your page/application/theme CSS definition and use that instead.
    .date_fmt {white-space:nowrap;}

     

    See :  http://www.grassroots-oracle.com/2016/11/ordering-and-formatting-date-columns-in-orclapex.html?m=1

    Ashish kjahsjkasj Sahay: 22-DEC-16
  • Change font color of font awesome icons

    Hi,

    Most of the times we do not want the default color of font awesome icons.

    To replace this thing we can use following : 

    Click on page Title , Go to to "JavaScript" > Execute when Page Loads > Paste the code 

    $('.fa-comments').css('color','blue');

    It will change the comment icon color.

    To change all the icons available on the page use 

    $('.fa').css('color','blue');

    yes​​​​​​​

    Ashish kjahsjkasj Sahay: 21-DEC-16
  • Cascade Select List in Tabular form

    Hey guys ,

     

    Once i was suffering in manual tabular forms, there i was having a requirement of cascade Select list.And obviously this is necessary if user select a value then another column should be populated based on value.

     

    Steps: 

    Create a Interactive or Classic report as per your requirement using APEX_ITEM API .

     

    Eg.

    SELECT

    APEX_ITEM.SELECT_LIST_FROM_LOV(2,deptno,'DEPT',

                                  p_attributes      =>    '  style="width:20vw"

                                                             onchange ="populate_emp(this.value,'||lpad(empno,4,4)||')"

                                                               onfocus ="populate_emp(this.value,'||lpad(empno,4,4)||')) dept,

    apex_item.select_list

                (3,

                 empno,

                p_item_id=> lpad(empno,4,4)) empno

               

    FROM emp

     

     

     

    Javascript Function in "Function and Global Variable Declaration"

     

     

    function populate_emp (pVal,next) {

    var id='#'+next;

    apex.server.process(

    "POPULATE_EMP_LOV", {

     

    x01 : pVal

                    }, {

    dataType : 'text',

    success : function (pData) {

     

                $(id).html(pData);

    }

    });

     

    }

     

    Application Process :

     

     

    DECLARE

       l_counter   NUMBER := 0;

       l_dept_id   NUMBER;

     

       CURSOR emp_list

       IS

          SELECT empno || ' - ' || ename d,

                 empno r

          FROM   emp

          WHERE  deptno=apex_application.g_x01;

     

    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 ('<select>');

     

    FOR c_cnt IN emp_list

          LOOP

             IF l_counter = 0

             THEN

                HTP.prn (   '<option value="'

                         || ''

                         || '">'

                         || 'Select</option>');

           END IF;

     

             HTP.prn ('<option value="' || c_cnt.r || '">' || c_cnt.d

                      || '</option>');

             l_counter := l_counter + 1;

          END LOOP;

       IF l_counter = 0

       THEN

          HTP.prn ('<option value="' || '' || '">' || '-- Select --'

                   || '</option>');

       END IF;

       HTP.prn ('</select>');

    END;

     

    Your cascade select list is ready :

    Output:

     

     

     

    Ashish kjahsjkasj Sahay: 13-DEC-16
  • Get Current Schema and DB name

    Hey Guys,

    Some times we do not know about our schema exist in which db and which is our schema

    hare is the method to find db and schema name

    DECLARE
       CURSOR ashish_db_name
       IS
          SELECT NAME
          FROM   v$database;

       My_db_name   VARCHAR2 (4000);
    BEGIN
       OPEN ashish_db_name;

       FETCH ashish_db_name
       INTO  My_db_name   ;

       CLOSE ashish_db_name;
       
    htp.p('Schema Name:'||SYS_CONTEXT ('USERENV',
                                  'CURRENT_SCHEMA'
                                  ));


    htp.p('My DB Name:'|| My_db_name   );
    END;

     

    Result::::::::::::

    Schema Name:ASH_SCHEMA
    My DB Name:ORCL

    Ashish kjahsjkasj Sahay: 12-DEC-16
  • Create Cascade POP UP LOV

    Hey Guys,

    There is a requirement to create a Cascade POP UP LOV , as we know we can only create cascade select list : meaning , we have one select list and another select list will be populated on the basis of its cascade.

    In the case of POP UP LOVs we faced the problem about cascading . This is very easy and by default provided by Apex in Select Lists.

    But with the POP UP LOVs what you need :-
    Step 1 :-

    Create a POP UP LOV ,example LOV on Dept 

    Create Item>P1_DEPT_LOV

    Type>POP UP LOV

    List of values> Sql Query> select dname d,deptno from dept

    Create another Item for Cascade lov

    Create Item>P1_EMP
    Type>POP UP LOV
    List of values >POP UP LOV
    List of values > Sql Query > select ename d,empno r from emp where deptno =:P1_DEPT_LOV

    Step 2 :-
    Resetting child POP UP lov on change of parent

    Create Dynamic Action > set session state
    event> change
    selection type> items
    items> P1_DEPT_LOV
    condition > -Select-

    Action> clear
    Affected elements>selection type> items
    items> P1_EMP (reset on change of parent)

    Set Session value of parent Item (P1_DEPT_LOV)
    Create another action 
    action > Execute PLsql code
    Setting > plsql code
    APEX_UTIL.SET_SESSION_STATE(‘P1_DEPT’,v(‘P1_DEPT’));



    now see the results.

    Initially:

    click on Popup menu ( I manipulated it to lock image this is just UI factor nothing else)

    lov Results(this UI also changed by me i am just playing with Apex now a days) Result in Item

     
             value in Session
     
    Result are exectly what select list gives.

    Ashish kjahsjkasj Sahay: 29-NOV-16
  • Recover Deleted Apex Application

    Hey Guys,

    This is actually no one wants that his application lost or deleted.
    Suppose we have an application APP ID with 200 .
    and unfortunately application deleted.Now no need to worry about this.

    You have great way to recover the application.
    Steps :—-
    1) create a new Apex application with the same ID of the deleted application.
    as i said the application 200 is deleted .Your new application is must be as of id 200.
    2) Now export this application on time whenever the application was in the workspace.
    3) Import it as usual.

    You will have your lost application.

    Enjoy …….laugh

    Ashish kjahsjkasj Sahay: 29-NOV-16
  • Recover Deleted Page in Application with APEX and Firebug

    Hey Guys,

     

    As usual project proceed under the team development. there may be , page can be deleted by any one,
    No one wants it but if it happened do not need to panic.This is easy to recover.

    i have faced this problem , some body deleted the page in the application
    to recover it you guys can follow the blow link. I followed steps to resolve this problem.
    Hope it will help you .🙂

    http://oracleapexsolutions.blogspot.in/2012/09/recover-deleted-page-with-apex-and.html

    Ashish kjahsjkasj Sahay: 29-NOV-16
  • Set item value in Session using PL/SQL

    Hey guys ,

    Hope you are enjoying Oracle apex and it’s magic.🙂

    some times i feel that the value of item is not set to session state. we can not save the value to session state untill unless we use submit the page with the item or submitting the page items as well.

    let say we have an Item as “P1_DEPT”.



    Create a Dynamic Action for the Item .

    Create Dynamic Action>
    Event      > change
    Selection Type  > Items>P1_DEPT

     



    Action > Execute PL/SQL code >



    APEX_UTIL.SET_SESSION_STATE
    (‘P1_DEPT’,v(‘P1_DEPT’));
     

    PAGE ITEMS TO SUBMIT > P1_DEPT



     

    Now type into item

     

    Ashish kjahsjkasj Sahay: 29-NOV-16
  • Pass Item to item Values Using Javascript

    HI guys,

    Here you have two page items, and a button
    eg.-
    P3_EMAIL
    P3_EMAILVIEW
    Show_BTN

    Problem- Pass  value of P3_EMAIL  to P3_EMAILVIEW

    Step 1 – disable item P3_EMAILVIEW using disable property

    Step 2- Add dynamic Action for the button Show_BTN
            
                    –  Create dynamic Action 
                    – Add action Execute Java Script expression   
                         
                        a = document.getElementById(“P3_EMAIL”).value;
                        document.getElementById(“P3_EMAILVIEW”).value=a;

                     – Affected Element > Selection Type – Items> items- P3_EMAILVIEW

    Result

    Ashish kjahsjkasj Sahay: 29-NOV-16
  • DEMO TEST

    TITLE TITLE TITLE TITLE

    Ashish kjahsjkasj Sahay: 15-NOV-16
  • test

    gi

    Ashish kjahsjkasj Sahay: 13-NOV-16