Thursday, June 16, 2011

Execution order differs with rendering mode

Today our tester found a big saying "Incorrect numbering of the tables in the PDF export".
The issue is that we have a custom code function incrementing a number and than returning the resulting number. It starts from 0 and it'll return 1 first time it is called, 2 afterwards, 3 and so on. It works fine when my report renders in HTML, but not when it renders as PDF. The first table is numbered with 5 and the rest are numbered in order 1 to 4

The only difference between the first table and the rest is that the first table displays the table number in a row, while for the rest I had to add a text box above the table.

Apparently, the execution order of custom code is different when report is rendered in browser vs when it renders as PDF. I did a simple test by creating a test report, with just a matrix, a table and a text box and the textbox is indeed rendered first (it executes the custom code first). Only after, the tablixes are rendered