Most of us print reports onto plain white paper these days, rather than the old report paper with pre-printed alternating white green rows/lines. For this reason, shading table rows in reports makes them easier to read, especially when printed landscape or on oversized paper.
This can be easily achieved in OIPI through a few lines of code added to the report’s stored procedure. The code is used to print each row of the table separately and to toggle the background shades between each row. For example:
Isappend = 0
Shading = 1
For each.row = 1 To num.rows
If shading = 1 Then
shading = 0
this.shade = rgb(220,220,220)
shading = 1
this.shade = rgb(0,0,0)
thisrow = table2
If thisrow = “” Then thisrow = ” “
x = Set_Printer(‘ADDTABLE’, ‘<840':@vm:'<960':@vm:'1200′:@VM:’>1200′:@VM:’>1440′:@VM:’>1440′:@FM, TABLE1, thisrow, ”, this.shade, isappend, TB_BOX_COLUMNS)
isappend = 1
As mentioned on the blog last week, not all of the old OIPI functionality works in OIPI.NET and this is another example. However, good to Revelation’s commitment to fix any issues that can be addressed internally, Bryan has already begun working on this requirement after it was raised with me by one of our clients, in fact I had an example within ‘four hours’ of suggesting this for a future release – now that’s service!!
For version 9.0.1, OIPI.NET has been modified so that it will work like OIPI in the example above. – that fixes the incompatibility issue between OIPI and OIPI.NET for those of you using the above example in your existing OIPI reports.
In addition, Bryan has made it even easier in OIPI.NET and added the ability to add multiple row colours. In an example that he sent to me the report has rows that alternate white-grey-red-white-grey-red, etc. This is achieved by specifying multiple shades in the background shade parameter (@VM-delimited), and OIPI.NET will alternate between the shades. For example:
ourshading = rgb(220,220,220):@VM:rgb(250,0,0):@VM:0
x = Set_Printer(‘ADDTABLE’, ‘<840':@vm:'<960':@vm:'1200′:@VM:’>1200′:@VM:’>1440′:@VM:’>1440′:@FM, TABLE1, TABLE2, ”, ourshading,”, TB_BOX_COLUMNS)
x = Set_Printer(‘ADDTABLE’, ‘<840':@vm:'<960':@vm:'1200′:@VM:’>1200′:@VM:’>1440′:@VM:’>1440′:@FM, TABLE1, TABLE2, ”, ourshading,’1′, TB_BOX_COLUMNS)
Please note that in this example 3 colours are defined, being grey, red, and nothing. The example also shows how the use of multiple addtables (with the ‘append’ parameter set on the 2nd one) properly keeps track of the alternating rows.