APEX Training

Monday, 2 March 2015

IR Scrolling - With a Little Help From My Friends

If you are working with interactive reports you will for sure be faced with a problem of wide reports. If you are taking care of the page layout and eventually have more than just an interactive report on the page, you will want to limit it's size to something making sense. The first problem will appear if you limit the width by setting the region attribute to something like this

style="width:830px"

and you will not see some of the columns:



If you add a scrolling by wrapping the region in a div and adding the following to the region header:

<div style="width:810px;overflow-x:scroll">

and closing it in the footer by adding:

</div>



you will be able to scroll with two ugly side effects:

  • The action bar will be included in the scrolling as well and disappear as you scroll to the right.
  • The sort widgets for the columns will appear on the wrong position the more you scroll.




  • You can solve this problem in the following way:

  • Remove the scrolling DIV from the region header / footer.
  • Use this java script in the page Function and Global Variable Declaration:

    function onload_ir(p_width, p_report_id){

    $('<div id="scroll_me" style="width:' + p_width + 'px;overflow-x:auto;display:inline-block"></div>').insertBefore('#apexir_DATA_PANEL'); $("#apexir_DATA_PANEL").appendTo("#scroll_me"); $("#apexir_DATA_PANEL").show();

    var or_Finished_Loading = gReport._Finished_Loading; gReport._Finished_Loading = function(){ or_Finished_Loading(); if(gReport.current_control=='SORT_WIDGET'){

    var offset_pos = $("#" + p_report_id ).position().left; var pos_left = $('#apexir_rollover').css('left'); pos_left = pos_left.replace('px',''); if (pos_left>p_width-100) {new_pos = parseFloat(pos_left) + parseFloat(offset_pos) - 25; $('#apexir_rollover').css('left', new_pos+'px');} }; }; };


  • Create a Dynamic Action which runs on the page load and executing this script there:

    onload_ir(810, 7990109002761687)


  • 810 is the widht of the scolling region, which is a bit less then the total width of the region.

  • 7990109002761687 is the id of the data grid of the interactive report. You can find this id if you use firebug and scroll to the point where the data grid is placed.




  • What this script does is:

  • It will wrap the data grid into an additional div and add a scroll bar to it.
  • It will overwrite the IR onload function and add a sort widget positioning function to it in order to reposition the widget according to the scrolling.
  • The important part of the overloading function was done by Tom Petrus, who is a big help when it comes to tricky stuff like this.

    Now, once you have done that, your report will show up properly once you scroll it.



    Enjoy.

    Wednesday, 18 February 2015

    The most frequently abused feature in APEX

    Today I participated in the Scott's survey:

    https://apex.oracle.com/pls/apex/f?p=70347:Q::AAC3

    and there was one really interesting question:

    "What do you think is most frequently abused? (and why)"

    If APEX has any week points than it is definitely the fact that you can place your code almost everywhere. Especially PL/SQL chunks of code. If I start counting and list all the places it will be a very long list:

  • Page Read Only and Cache Page Condition
  • Region Conditional Display and Read Only Condition
  • Buttons Conditional Display
  • Items Conditional Display
  • Items Source value or expression
  • Items Post Calculation Computation
  • Items Default value
  • Items Conditional Display and Read Only Condition
  • Computations
  • Processes on Submit, on Load, on Demand
  • Validations and Validation Conditions
  • ...and yes, Dynamic Actions as my favorite.


  • There is of course more but I will stop counting here. If you start working with APEX this is great - you will easily get on target and have an application up and running in no time. A little bit of code here, a little bit there and there we go.

    This problem becomes obvious if you application is more than just a small and temporary solution shared between a couple of people. As an application grows it will start suffering from performance issues. Furthermore it will be hard to maintain it. It will have a dozens of complex pages with many items, many computations and processes, conditional buttons, validations and dynamic actions. If you practice writing anonymous PL/SQL blocks and you paste those wherever it is possible, your code will become redundant and slow. You will probably repeat the same code many times on your page. This means, your pages will require more processing time than they should. I would even go so far and say this is almost as bad as putting your business logic into triggers. Have you ever had a chance to debug such applications (and you didn't know the code was placed there)?

    The possibility to have so many options is of course great and useful. But it doesn't mean you should use all of the options. The other thing important to know is that you should never write anonymous PL/SQL blocks in your applications. Never! Whenever you need to use PL/SQL, you should use packages and place your code there. The probability that you will then repeat your code is quite low and for sure your application will run much faster.

    My proposal for the future version of APEX would be to have a subtitle for each of those containers saying "Handle with care" and providing some explanations why. I am serious here. Really.

    Alert Function

    In APEX you will probably use javascript alert function in many cases by saying:

    alert ('some message');

    The popup box you get looks a bit strange and outdated. As an alternative to this you may use this function call:

    function get_alert (p_message,p_id) {$("<div/>", { "html":p_message}).attr({"title":"Error has occurred!"}).dialog({
    modal:true,
    buttons:{"Go to Error":function(){$(this).dialog("close");
    $(p_id).select();}}
    }); }


    As you can see in this example, you can add additional functions to this alert box in order to do something after closing of the alert message. You can choose to display the alert as a modal window as well.



    Enjoy.

    Tuesday, 17 February 2015

    APEX Jobs

    Alle, die eine Beschäftigung mit Oracle APEX suchen, sollten hier reinschauen:

    Joel's Blog

    Auch einige Stellenangebote aus Deutschland und Schweiz.



    Wednesday, 4 February 2015

    APEX 5.0 - Run Applications in New Tabs

    If you are using Firefox you will probably have an issue with running pages from APEX Builder 5.0 in new Tabs. Now, the links are working differently and normally clicking at button "Save and Run Page" will open a new window. In order to get it opened in a new tab, you will need a plugin Tab Mix Plus. Once you have it, you will need to change the settings there as shown in the screenshots below.



    Sunday, 18 January 2015

    How to download a plugin from apex-plugin.com

    I am not sure how many times it has happened to me that I can't use my login for this site. Today, it is not possible to login into that application - again. I was trying to reset my password several times for both accounts I have there. I received the emails with a token, entered that token and after changing the password, nothing happens. I didn't even receive a message that the login isn't possible or wasn't successful. Simply nothing shows up. Maybe I am just not getting it and there is a step I am missing...

    It is o.k. to track who downloads what and use the accounts for advertising. However, you should make sure your login and the password reset works. That is so simple.

    Saturday, 6 December 2014

    Good Blog Bad Blog

    Just checked if the http://www.odtug.com/apex is available again and it is. It seems the people there are filtering blogs because I don't see my blog post from yesterday appearing there and I don't understand why. Is that just because I said that the old blog listing was much better? Or this is just another technical problem they have? Am I going to be removed from that blog listing forever if I continue saying things which they may not like?

    Friday, 5 December 2014

    You shouldn't think this happens only to you

    Since several hours I am getting this while trying to access all blogs at http://www.odtug.com/apex. It seems that this list has a lots of problems listing all the relevant APEX blogs. The previous version from Dimitri was so much better and user friendly.

    Tuesday, 11 November 2014

    Value Placeholder

    Did you know that you can use Value Placeholder in your page items to display hints for the users? This is a quite neat feature you can implement without using different plugins for displaying hints. It will also work with the APEX ampersand substitution strings like

    &P1_ITEM.

    Here is how it looks like. Be carefull with this. It will work only for the browsers supporting HTML5.

    Tuesday, 21 October 2014

    APEX Connect 8th and 9th of June 2015 in Duesseldorf Germany

    APEX Connect is the first big APEX event in Germany and will be taking place in Duesseldorf on 8th and 9th of June 2015. You can still apply for a presentation using this link. I will be there with a presentation on APEX Plugins. As far as I know a couple of international guests are expected to be there as well. This event will for sure be interesting and informative so you should think about participating. Düsseldorf is close to Belgium and Holland so I think that we will have quite a lot of visitors from those counties as well. It just comes to my mind that the presentation should be in English. So, you should make sure to book your ticket, hotel and travel in time.

    Friday, 10 October 2014

    APEX 5.0 New Features - Terminverschiebung

    leider müssen wir den Termin für den bei uns gebuchten Kurs "Oracle APEX 5.0: New Features" (Termin: 08/09.12.2014) auf den Februar 2015 (09.02/10.02) aus gegebenem Anlass verschieben.

    Wie Sie/Ihr bereits bestimmt erfahren haben, wird sich das Release von Oracle APEX 5.0 etwas verschieben: https://blogs.oracle.com/apexcommunity_deutsch/de/entry/openworld_update_application_express.

    Sie können sich hier zum Kurs anmelden.

    Tuesday, 16 September 2014

    XML Parsing Error: no element found Location: ...

    I am just working on an application which is supposed to be exposed to public users. I created a simple ajax process there which gets a value of an application element and does something based on the value. While calling the on demand process I am getting this error while not authenticated:

    XML Parsing Error: no element found Location: moz-nullprincipal:{6492ed13-2b81-4989-938c-7c19121f419a} Line Number 1, Column 1:



    After searching for this error in combination with APEX I found my old thread from 2012 which basically wasn't answered:

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

    After investigating what is happening there I noticed that the on demand process I created is set to "must not be public user" in the authorization section. Obviously APEX does that by default for the on demand processes. Running the ajax call would not find the "element" which is the actual process.

    Saturday, 13 September 2014

    Mein APEX Vortrag bei Orbit in Bonn

    Am 05.11.2014 halte ich einen Vortrag über Rapid Application Development bei Orbit in Bonn. Dabei wird auch noch mein Freund und Kollege Tobias Arnhold sein. Er wird über die Themen Plugins und Reporting sprechen. Anschließend zeigt Frank Weyher (der ebenso ein guter Kollege und Freund ist :)), wie man APEX mit Office integrieren kann.

    Die Themen sind sicherlich interessant und eine Anmeldung lohnt sich sicherlich. Der Link zu der Veranstaltung finden Sie hier.

    Wednesday, 10 September 2014

    APEX - Default Branch on Submit

    Yesterday I spent two hours on debugging one of my applications and searching for an answer. Of course, the problem was caused by myself. Here is what happened:

    I copied a page and deleted the region including buttons and items using the Cascade to Delete Buttons option.



    Then I created a form and had there a process on submit to upload files in my table. Everything was working fine except the fact that after the process the page would show up empty having the funny

    wwv_flow.accept

    message.



    Looking at the page I couldn't see anything what would point to the actual problem. The process was there and it was running and the branch was there. Only after a while I looked into the branching and saw there that it was conditional - firing when the deleted button was pressed.



    Then it came to my mind that this wasn't the first time I had this problem. I think this is a bug and it has to do with the file browse item. I expected the page to redirect after submit since this feature is there since 4.0. However, it didn't. This issue seems to be fixed in 5.0.

    And one more thing to add: It does make sense to create conditional branches but it doesn't make sense to create unconditional ones. The feature of creating unconditional branches to the actual page, where the branch resides, should be removed completely.

    You can see it in "action" here

    Wednesday, 3 September 2014

    APEX 5.0 New Features Schulung

    Unsere nächste Schulung hat APEX 5.0 New Features im Fokus. Diese findet im Dezember am 08. und am 09. in Bensheim statt. Wenn Sie auf diesen Link klicken, können Sie die Details anschauen und sich ggf. anmelden. Dieses Thema is sehr spannend und viele neue Features bzw. Änderungen kommen auf uns zu. Wir denken, dass Dezember der richtige Zeitpunkt dafür ist, damit anzufangen.

    Tuesday, 5 August 2014

    Set Focus on Added Row Tabular

    This sounds quite simple:

    "I would like to set focus on the new added row in my tabular form."

    In the following example, you can se how to acomplish that.

    Cascading Shuttle - Keep Selected Values

    There are probably a several good ways to solve the following problem:

        1. you have a simple select list which cascades a shuttle element
        2. you select something and the shuttle is populated
        3. after that, you pick a value in the shuttle and move it to the rigt side
        4. then you change the select list again
        5. the values you selected in your shuttle are now lost


    This example shows how this can be done. This question apears in the APEX Forum from time to time and I decided to provide one simple solution for it.

    Thursday, 31 July 2014

    jQuery - loop through a Tabular Form

    This question is one of the frequently asked questions - "How do I loop through a tabular form using a dynamic action?". This example shows how to loop through a tabular form and set the values for each row to what ever you want. Using apex_application.g_fxx array is not an option for onload processes or dynamic actions. It can only be used in an on submit process. Using jQuery in a simple loop it is possible to read / set any of the values in any column. Try it out.

    OTN APEX Forum again

    The OTN Forum is not available (again). This usefull but constantly changing forum now gives me the following message:



    I am not sure why they are using jive for that. Maybe APEX would be a better solution.

    Monday, 21 July 2014

    OTN APEX Forum Link

    Oracle again changed the layout of the forum. For me, the old link didn't work any more. In case you have problems finding it, here is the new link:

    https://community.oracle.com/community/database/developer-tools/application_express

    If you go to the forum and search for example for "APEX" or "Application Exp", you will see no results. Typing in "Application Ex" will find "Application Express".



    Each of the found links will have a funny description saying:

    "An error occurred processing your request. If this problem persists, please contact the webmaster or administrator of this site."



    :) So, it seems there are now even more bugs than before.

    Probably, the intention to change the forum wasn't bad. However, once you manage to open it you will see a lot of information you don't need (or at least not all of the time). The real content is somewhere underneath and needs scrolling like in Facebook (oh, how I hate that site). And the worst thing is that you can see only ten threads per page - if you want to see more then click and scroll again. For those interested in helping others this is making things much more complicated.



    One positive thing though. :) My name suddenly appears in the top list of the participants in the forum. The list isn't reduced to the top five but it now shows the top six. Top six is obviously the new top five. ;)