Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
knowing number of columns appearing in a cross tab dynamically
mhw
<p>Hello,</p>
<p>Is it possible to know the number of columns appearing in a cross tab so that this number can be used in a script.</p>
<p> </p>
<p>For ex it is possible that if i run a report for 30 days,the cross tab shows only 10 columns since data is available only for this 10 days.</p>
<p> </p>
<p>I want to somehow know how much columns will appear in cross tab before hand so that i can use it in a script in before factory.</p>
<p> </p>
<p>Thanks,</p>
<p>regards,</p>
<p>mhw</p>
<p> </p>
Find more posts tagged with
Comments
JFreeman
<p>You could potentially use a computed column in the data set for this.</p>
<p> </p>
<p>You could also use some javascript with a persistent global variable and count the number of unique values for the column in the data set in the onFetch of the data set.</p>
mhw
<p>hey,</p>
<p>thanks a lot for your help and fast reply...</p>
<p> </p>
<p> </p>
<p>I have one more question is it somehow possible to use the value obtained in an aggregate function of a cross tab,to be used in a script in before factory or onrender.</p>
<p> </p>
<p>I have to use the value obtained by it in a if statement.</p>
<p> </p>
<p>If yes how to do it.</p>
<p> </p>
<p>Thanks,</p>
<p>Regards,</p>
<p>Mhw</p>
JFreeman
<p>That type of aggregate value is going to be generated after the processing of beforeFactory.</p>
<p> </p>
<p>Would you like a sample report demonstrating how to do my first two suggestions?</p>
mhw
<p>Hello Freeman,</p>
<p>Yes i would be glad if you could send me a sample report.</p>
<p> </p>
<p>Thanks,</p>
<p>mhw</p>
JFreeman
<p>This is looking to be a little bit more complicated that I originally anticipated.</p>
<p> </p>
<p>In order to adjust the master page width, it must be done in beforeFactory.</p>
<p>However, beforeFactory executes before the data set fetches it's data.</p>
<p> </p>
<p>Due to this, the only option I have been able to come up with is to use DEAPI to manually create a temporary dataSet and query the data in beforeFactory. Then iterate through the results to use logic to determine the number of columns the crosstab will contain once it is built.</p>
<p> </p>
<p>I am going to work on making a sample of this for you.</p>
<p>It's going to be a bit more code heavy that I had anticipated.</p>
mhw
<p>hey freeman,</p>
<p>Sure i will be waiting for the sample report.</p>
<p> </p>
<p>Thank you so much for your help and time...</p>
<p> </p>
<p>Thanks,</p>
<p>regards,</p>
<p>Mihir</p>
JFreeman
<p>What version of BIRT are you using?</p>
<p>I want to make sure the example will work with your version.</p>
mhw
<p>I am using Birt 3.7.1 </p>
<p> </p>
<p>Regards,</p>
<p>mhw</p>
JFreeman
<p>Take a look at the attached example.</p>
<p> </p>
<p>I use the DEAPI to query the data set in beforeFactory and then iterate through the results with some logic to determine the number of columns that should appear in the crosstab. I then adjust the master page width accordingly.</p>