Wrapping radio prompts in an Active Report

My apologies for not posting for a long time. On February 1, I was hired by PMSquare as a solutions architect. In addition to flying back and forth over the Atlantic, I was busy writing a training manual. It covers JavaScript, local classes, a brief intro to modifying RAVE graphs, and Cognos Mashup Services. Use the contact form if you’re interested in learning more about it. Now that I’ve actually finished it, I can go back to updating my blog.

An interesting problem was forwarded to me. An Active Report needed to have a data checkbox prompt wrap around. In some scenarios there were too many values for a simple horizontal prompt, and the vertical prompts wouldn’t fit at all. The solution is fairly simple, and you can jump to the end of the article if you don’t care about how I found it.

Horizontal radio and checkbox prompts are actually single row tables with multiple cells. Tables are notoriously difficult to reposition with CSS, and there’s precious little in the HTML that we could use to style.
radio horizontal

My first thought was we could use JavaScript, but loading scripts automatically is difficult (but not impossible, see Bob’s BI blog). The next idea was to group the members in sets of ten and use a master detail to generate a series of prompts. That had the double whammy of being difficult to support and being absolutely insane (which, to be fair, hasn’t stopped me from developing some other solutions).

Next let’s look at a vertical prompt. I figured it would be built similar to the horizontal, a table with one cell and multiple rows. In fact, a vertical checkbox prompt is actually that.
checkbox vertical

Oddly a vertical radio prompt is a series of divs.
radio vertical

And each of those divs has a class associated, clsListItem_normal, with it. This makes it possible for us to play with local classes. Normally, we should be able to simply create a class with the same name. Unfortunately some wise-guy in the RS dev team decided to make life difficult. The RS local class gui gives us an error message when we try to create a class name containing an underscore. So we need to get clever.
invalid class name

Currently IE is the only browser that allows Report Studio to work with the system clipboard. So save your report and reopen in IE (unless you’re already using IE for report development, you poor schlub). Remember to click “allow” if it asks you for permission to access the clipboard.
Now, instead of changing the name of the class, cut the class into notepad, and change the class name there. Paste it back into the local class and voila, we have found away the silly and arbitrary “no underscores” rule.

 <RSClipboardFragment version="2.0"><classStyle name="clsListItem_normal"/></RSClipboardFragment>

Now, let’s set the box type on the class to inline, and right margin to 10px, and run the report.
wrapping radios

My experiments show that the wrapping radio buttons will continue to work across browsers and platforms. Unfortunately this will not work with checkbox prompts, until they are changed to divs instead of tds.

The attached report is based on 10.2.2. I’m not sure how the radio prompts are built in previous versions. In any event, 10.2.2 is the first version since 8.2 that allows you to actually set the class name instead of just the class label. So you’ll need to use the copy/paste technique anyway.
wrapping-radios.txt (620 downloads)