Sometimes a classic report with many columns takes up too much space on the screen. There are a number of options for dealing with this issue, but one that I like is to provide the user with the ability to turn on and off individual columns or groups of columns.
I have seen several different ways of providing this functionality. For instance, Denes Kubicek has a solution in his sample application, but it does not handle column groups and is somewhat more awkward. So, for what it is worth, I thought I would share my solution.
First, I create a series of checkbox items representing the columns (or column groups) that I want to allow the user to "turn on and off." I put these items in a hide and show region so that they are accessible but not necessarily displayed until the user wants to change the columns.
Next, I modify the report. I set the Conditional Display attributes of each column in order to reference the related checkbox.
In some cases, I have more than one column being controlled by a single checkbox. My report has several columns that display dates. I use a single "date" checkbox to turn off and on the entire group of columns.
Next, I create a dynamic action for each of the checkbox items. The dynamic action is triggered by the "Change" event of the checkbox.
There are two true actions. The first, Execute pl/sql Code simply serves to put the value of the checkbox item into session state.
The second action simply refreshes the region containing the classic report.
You will need to repeat the above steps to create an dynamic action that will trigger on the change of each of the checkbox items.
The result allows the user to quickly enable or disable columns. Due to the use of the dynamic actions, the report quickly responds to the user changes. You can set defaults for the checkbox items so that some of the columns will show on page load and others will wait for the user to select the column for display.
Bruce,
ReplyDeleteNice post!
Keep an eye out for the "Page Items to Submit" attribute of Classic Reports in APEX 4.1. This will allow you to reduce this down to a single Ajax request that just refreshes the report.
Regards,
Dan
Hi Bruce,
ReplyDeleteI'm so glad you included this in your blog! This is exactly what I was looking for! I have one small problem tho...as soon as I click a checkbox (to deselect a column), the region refreshes but all of the columns disappear. I have the checkboxes default value set to 1 so all columns are initially displayed. Any ideas?
Thank you thank you thank you!
T
Great post
ReplyDelete