Home
Analytics
Invalid Design file
femibyte
Hi, I am generating an invalid design file and the error I'm getting in Eclipse is the following:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>Description Resource Path Location Type
The table "Table("dataTable")" has inconsistent column count. Report.rptdesign /Birt Tutorial Reports line 85 Report Problem</pre>
<br />
I generated the report design using the BIRT Report Design Java API. <br />
Can someone tell me how I can debug this file ? How do I find out where the various column counts are ? I am implememnting column spanning in the report header by dropping cells, and I suspect that this error might have something to do with it. Is there an easy way to look at the .rptDesign file and figure out the problem?
Find more posts tagged with
Comments
mwilliams
Once you've generated the rptdesign file, you should be able to open it, in Eclipse and see the XML source.
femibyte
Unfortunately, I'm not very good at deciphering the error message. I have attached a design file that has the following error.<br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>The table "Table("dataTable")" has inconsistent column count because of drop properties of some cells in group header. RepDesign.rptdesign /Birt Tutorial Reports line 83 Report Problem</pre>
<br />
Can you help me decipher which cells have the problems and how to fix it ?
mwilliams
I've tried editing the XML source to figure out the issue and get the element to show, with no success. Can you show the code you're using to create the table?
femibyte
I have attached the java class used to generate the report. Let me know if you need anything else.
mwilliams
Try commenting out the portion of the code where you drop cells and set the column span. I think this might be where you're running into issues.
mwilliams
Alright. I stepped through your XML source and found exactly where the issue was at. Attached is the fixed report. When you're setting your column spans, you're not removing enough cells, so you end up with extra cells in some header rows. In your XML source, delete cells 39, 146, and 191-194 and you should get your table to show up, like in the attached report.
femibyte
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="109290" data-time="1347547138" data-date="13 September 2012 - 07:38 AM"><p>
Alright. I stepped through your XML source and found exactly where the issue was at. Attached is the fixed report. When you're setting your column spans, you're not removing enough cells, so you end up with extra cells in some header rows. In your XML source, delete cells 39, 146, and 191-194 and you should get your table to show up, like in the attached report.<br /></p></blockquote>
<br />
Thanks a million for your help. The problem is that my report has a multi-line header, and some of the text needs to span across columns. I've been using drop() to implement the column span. Is there a way to do this differently and avoid the complexity involved with drop() altogether?
mwilliams
Dropping the cells should work fine. You just need to make sure you're dropping the correct number of cells.
femibyte
This can get a bit complicated in the case of multiline headers where each line has different colspans for the text.<br />
<br />
Here is an example of an XML header snippet that details the format.<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><row num="0">
<rowText startCol="0" colSpan="2" fontWeight="normal" textAlign="left">Location</rowText>
<rowText startCol="16" colSpan="4" fontWeight="normal">Full Company Name</rowText>
<rowText startCol="23" colSpan="4" textSize="13pt">Short name</rowText>
</row>
<row num="1">
<rowText startCol="0" colSpan="2" fontWeight="normal" textAlign="left">date</rowText>
<rowText startCol="16" colSpan="3" fontWeight="normal">Department/rowText>
</row>
<row num="2">
<rowText startCol="0" colSpan="4" fontWeight="normal" textAlign="left">ReportName</rowText>
</row></pre> <br />
So for Row 0, I'd like the Location to start at cell 0, and span 2 columns.<br />
The Full Company Name should start at cell 16, and span 4 columns, on the same row.<br />
The Short name should start at cell 23 and span 4 columns. <br />
How would you suggest I implement the dropping of these columns ?<br />
<br />
For row Number 0, Location should I drop cells 0 & 1, or 1 & 2 ?<br />
And once I've dropped those cells, I need to drop cells 16-19, or 17-20 ? I also have to take into <br />
account that cells 0-1 or 1-2 on the same row may have been dropped.<br />
<br />
The code that tries to achieve this is as follows:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
int numDropped=0;
for (int idx=0;idx<rowTexts.size();idx++)
{
RowText rowText=rowTexts.get(idx);
int startColNum=rowText.getStartColNum()-numDropped;
int colSpan=rowText.getColSpan();
for (int cellIdx=startColNum+1;cellIdx < startColNum+colSpan;cellIdx++ )
{
if (tblHdrRow.getCells().get(cellIdx) !=null)
{
tblHdrRow.getCells().get(cellIdx).drop();
System.out.println("Dropping col:" + cellIdx);
numDropped++;
}
}
}</pre>
mwilliams
For the first one, the column span is only 2, so you'd only drop one cell to make up for that span. You'd want to drop cell 1 and set cell 0's span to 2. You'll just need to make sure you're keeping track of the number of cells plus column spans that you're at. At first glance, it appears your code does that, but without being able to test, I might be missing something. What does it show when you're printing out which cells you're dropping?
femibyte
So I'm doing that. For each column span, I drop colSpan-1 number of cells. <br />
<br />
So for this format snippet below:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><row num="0">
<rowText startCol="0" colSpan="2" fontWeight="normal" textAlign="left">Location</rowText>
<rowText startCol="16" colSpan="4" fontWeight="normal">Full Company Name</rowText>
<rowText startCol="23" colSpan="4" textSize="13pt">Short name</rowText>
</row></pre>
<br />
I'm supposed to drop 1 cell and 3 each for colSpan 4 using this piece of code:<br />
<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>for (int cellIdx=startColNum+1;cellIdx < startColNum+colSpan;cellIdx++ )
{
if (tblHdrRow.getCells().get(cellIdx) !=null)
{
tblHdrRow.getCells().get(cellIdx).drop();
System.out.println("Dropping col:" + cellIdx);
numDropped++;
}
else
{
System.out.println("Null cell:" + cellIdx);
}
}</pre>
This produces the following output:<br />
<br />
<blockquote class='ipsBlockquote' ><p>startColNum=0 compStartColNum=0 colLimit=2<br />
Dropping col:1<br />
Text: Location startCol=0 colSpan=2<br />
startColNum=16 compStartColNum=15 colLimit=20<br />
Dropping col:16<br />
Dropping col:17<br />
Dropping col:18<br />
Text: Full Company Name startCol=15 colSpan=4<br />
startColNum=23 compStartColNum=19 colLimit=27<br />
Dropping col:20<br />
Dropping col:21<br />
Null cell:22</p></blockquote>
<br />
The problem seems to be that cell 22 is null and isn't dropped. Why would cell 22 be null ?
femibyte
Ok, I now realize why there is no cell 22. There are a total of 27 cells and I've deleted 6 already, hence there
are only 21 left. This brings me to the question. Should all header rows in a multi-line header end up with the
same number of cells, even if there are different colspans hence different number of cells to be dropped ?
If that's the case, that's where my problem lies. In the case of a row with a lesser cumulative colspan, I need to drop additional cells to compensate so that each header row drops the same number of cells in total
mwilliams
Yes, you'll need to have a different amount dropped if there is a different span. If you have a row with cells with a span of 9, 4, and 4, and you have 27 columns, you'll need to drop 8 + 3 + 3 cells to make up for the extra span.
If you have only one cell with a span of 4, you'll only need to drop 3.
It appeared to me that this was what your code did. There just might be an issue where you're not dropping enough cells because your count is going out of bounds in the cell array, which is why you'd be seeing the null column.