Tuesday 1 November 2016

Build Options on Report Columns

Let's say you're experimenting with a report (IR or classic) column and you would only like it to appear in you development environment.

What options do you have for hiding that column in other environments?

  1. Don't migrate the change - use your source control processes to only move it when it's ready. This isn't always practical, nor the intent, particularly since you can programatically set the status.

  2. Add server condition on database name - we can use an expression such as
    sys_context('userenv','db_name') = 'dev'This isn't bad, I have a common function I call for this sort of thing. But it's quite granular.

  3. Build Options - under-utilised silent catalyst that can help us turn a group features off/on at the flick of a switch.
In Oracle APEX 5.1, Build Options are an attribute of each column, in addition to just about every other component in the builder.

APEX 5.1 Column Attributes

Prior to APEX 5.1, column definitions were one of few components that don't have a declarative option. However, we still have the magic of dictionary views.

Pre 5.1 Build Option on Column
So we can query the application's build options and determine if the relevant record is switched on.
select null
from apex_application_build_options
where build_option_name like 'My build option'
and build_option_status = 'Include'
and application_id = :APP_ID
Again, you could put this in a re-usable function/view, not that you would need it often.

Neat.

2 comments:

Jochen said...

Hi Scott
thanks for your post.
I just switched from Option 2 to Option 3 after i figured out i can just exclude on Export.
My question:
If you want to include your items in the next release do you just edit all items and remove the built Option or do you Switch "Default on Export" from exclude to include?

Thanks
Jochen

Scott Wesley said...

I flick the switch on the build option, some people build this into their apps. I think the sample apps demonstrate this.

The question I think is how to remove them once they're done. I think just removing the build option leaves dead references. I think...