Inside Oracle APEX by Patrick Wolf

"Comment out" an Oracle APEX Process, Validation, Branch, ...

Sometimes during development there is the requirement to "Comment out" a Process, a Validation, ... in an Oracle Application Express (APEX) application. To skip a step which doesn't work anymore, or where a user says he doesn't need that anymore but where you are sure that next week you are going to add it again...

In Oracle Forms that's quite simple. You just have to rename the trigger to use underscores (eg. PRE-QUERY to PRE_QUERY) and the trigger doesn't fire anymore. But how can you do that in Oracle APEX?

Sure you can comment out the PL/SQL code, if it's a PL/SQL process, but don't forget the NULL; so that you still have a valid code. But what to do for the more declarative process/validations/branches/...? You could set the "Condition Type" to "Never", but that will change probably an existing condition. And afterwards when you want to enable it again, you have to know what has been set before.

It think there is a much more elegant way to do it. It's called the "Build Option".
  1. Go to Shared Component\Build Options and create a new one with the name "Commented out".
  2. Set the Status to "Exclude"
Now you are able to "disable" any object in your Oracle APEX application by assign the new build option with the "Configuration\Build Option" property. This property can be set for almost any object in Oracle APEX.

And the good news is, there is even a report which shows you all the objects which are "Commented Out". Have a look at the "Utilization" tab in Shared Components\Build Options.

Labels: ,

4 Comments:

  • Patrick,

    Nice trick! Will come in very useful.

    Anthony.

    By Blogger Anthony Rayner, at 19 December, 2007 10:30  

  • thanks for the tip

    isn't it that this functionality can be achieved most of the times with conditional display-Never ?

    some more questions:
    * from the readability point of view which is more developer friendly for you?: the utilization tab or seeing Never on the ( Page definition )
    * which would be faster on running?: disabling by build options
    or disabling by condition-never
    or both

    By Anonymous Mihaï (apex newbie), at 20 December, 2007 05:48  

  • Hi Mihaï,

    just noticed that I have made a typo in the above text. Instead of "None" it should have been "Never". I have fixed that.

    So see above why I wouldn't use the condition type. About the performance. Should be the same, because both are fixed wired checks in the APEX rendering code and remember, it should always be the exception that objects/code is commented out so you will hardly be able to measure a difference between this two methods.

    About "readability": There a pros and cons. When you are going to deploy your application, the "Utilization" tab gives you a quick quality check to verify if there is code which shouldn't be commented out. For the conditions you can't do that. Pro for the condition is that you see it immediately on the page overview that the object/code is not used. BTW, I will add a highlighting for the "Build Option" to the APEX Builder Plugin as I did for the "Comment" field to make it better visible.

    Patrick

    By Blogger Patrick Wolf, at 20 December, 2007 09:38  

  • thanks Patrick

    sorry for missing the first explanation on Condition Type

    By Anonymous Mihaï, at 20 December, 2007 10:20  

Post a Comment

<< Home