Last Updated:

Modifying a Rhapsody Table in a PUB Report

Andy Lapping Tip

This week a client came to me with an interesting problem. When running PUB reports on Rhapsody, we can get table views out pretty easily. I documented that tip here: http://merlinscave.info/Merlins_Cave/Tips_n_Tricks/Entries/2019/2/20_RPE_-_Reporting_Rhapsody_Table_Views.html

This is great because the table can use java, context patterns and so on - Rhapsody does the heavy lifting - PUB simply reports the content that Rhapsody provides. But what if you want to modify the table in the generated report ? For example, change the color scheme or change the column widths. What if you dont want the cell content to be hyperlinks ? (by default they are). 

The answer is pretty simple. Rhapsody returns the table content as XHTML (which is basically HTML but more strict). If you print out the DataAsXML content as a string you can see how it looks - and work out what you need to modify. You are already using a JavaScript node in PUB to output the data - so all you need to do is modify the HTML before it gets pushed into the report.

Here is a sample template that:

  • Changes the header row color based on a variable
  • Removes the hyperlinks
  • Changes the width of one of the columns (as an example)
A Rhapsody Table View
A Rhapsody Table View
The Same Table generated as a Word Document