Hi all,
I have been working on making my own native custom controls and decided to try and make a useful column toggle custom control for Cognos reporting List Data Container.
The common solution to show/hide list columns dynamically is a cumbersome setup of conditional styles and render variables along with prompts to trigger report re-renders. I saw on the Scriptable Reports documentation that they have a method setColumnDisplay which doesn't work very well for pagination, only uses indexes, list title names, and will not work on lists that have group row spans, headers, or footers. It will throw errors very easily that would make users feel as though they did something wrong while using normal features of the on-demand toolbar.
I made a native custom control that will automatically look at the current report specification and the table rendered on the report page to dynamically get all the column titles and index them for you into a drop-down checkbox list. The configuration also allows for you to choose your column titles in the dropdown.
This also will preserve the column visibility during pagination, disabled the column toggle feature during if a user filters a list with no data, or has group row spans, headers, and footers, and lastly doesn't require report re-queries. It feels fast and I think pretty seamless.
You don't have to use it as a native custom control. I have two versions, and I think the regular ToggleColumn_CC should work for pretty much any version of Cognos Interactive Reports past 11.1. I only tested it on 12.0.4 and 12.1.0 but I think it should be ok for Cognos 11.1+. If anyone could test it on other versions that would be awesome.
Just for reference the native custom control is only supported on Cognos 12.0.3+.
I hope to add the following features in the future:
- Column toggling for reports with group row spanning.
- Dynamically adjusting the list width when using "Scrollable area height" on list reports. This requires a more complex solution for adjusting column widths and is not considered in the setColumnDisplay method from Cognos.
I already have some ideas how to implement these but for now, I think this is a step up on any other solution out there. Feel free to reach out if you have any questions and feedback is very welcome.
P.S.
@Shaveta Srivastava also just posted a blog where he released a similar solution using native custom controls called a dynamic list however it doesn't preserve column state across pagination, and I had issues uploading the native control to my Cognos on demand instance. I think it is a good way to show how native custom controls can work however I think my version may be more useful for production scenarios.



------------------------------
Michael Webb
------------------------------