Merging reports with RDLData

As some of you may already have discovered, there are some new challenges coming with NAV 2009 when upgrading or merging reports.

In my eyes the best way to merge NAV-Objects was and still is using text-comparsion. This still works with Reports, even if they contain RDLData. But you can damage the RDLData of an object in a way that won’t allow you to properly edit it in Visual Studio again. The most common error I received while merging reports was one ore more lines in the design containing not the same amount of columns as the rest. This could happen if you add one field to an existing line, and another line where you forget to add a new empty field for the data to match.

 

I designed a small example to show you what I mean.

Initial Layout:

Developer A’s Layout:

A new line was added.

Developer B’s Layout:

A new field was added to the tablebox (this means that it was added to all lines).

The new field was merged with exisiting fields in all rows where it isn’t needed.

 

This error can easly be found and corrected, as long as there are only a couple of tables, lines and fields.

But what to do if there are so many fields, that you can not find the wrong line of code?

Since report design in RDLData is not too different from HTML, I wrote a small tool to sum up the columns per row. This tool now allows to find the part of the object-text-file causing the trouble.

This is the result of a fine working report:

How to read:

This reports’ RDLData show one table (with the name “Table1”) containing seven rows.

The first row starts in line 121, the last row starts in line 314. Each row has two columns. In four cases this means two cells / two textboxes, whereas in three cases there is only one cell / textbox with colspan of 2 (this is a merged tablecell in Visual Studio).

 

Coming back to my example I ‘ll show you the result of a 3-way-text-merge using a common tool (in this case I used Beyond Compare)

As you can see, the table-structure is totaly messed up. After successfully importing and compiling the object in NAV you will get an error when you try to edit the layout.

What I do now is looking at the result of the tool’s analyse:

The largest row contains of 4 columns, so I should change the other rows to the same amount of columns. The easiest way of doing this is inserting the ColSpan-tag to the first tablecell-element of each row. In the first row this would be <ColSpan>2</ColSpan>. In the second row it would be <ColSpan>3</ColSpan> and in the third row I only have to change <ColSpan>3</ColSpan> into <ColSpan>4</ColSpan>, and so on.

As some of you may have noticed this is too much effort in this case. The faster way is to remove the ColSpan-Tag from the row starting in line 330 and only add/edit the tag to the rows with currently 2 columns.

After doing this you will be able again to edit the layout in Visual Studio, which I highly recommend after having randomly added colspans.

 

The Sourcecode of this tool will be uploaded after a short code-review, which will be done within the next days.

Update: FindMissingTableCellsInRDL