Denes Kubicek ApEx BLOG

APEX Training

Monday, 2 March 2015

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:

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.

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.

Wednesday, 4 February 2015

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

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

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

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

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 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.

Tuesday, 16 September 2014

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.

Wednesday, 10 September 2014

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.

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

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.

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. ;)