Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
conditional output of content
andreas2
Hi,<br />
<br />
I was designing some reports heavily based on the "visibility" feature of e.g. table rows.<br />
Wondering why my already long running reports got worse in an almost exponential degree relative to the query returns I put some logging in place and recognized, that the visibility (although set to hide->for all outputs->"true" or "false" based on some outer table content) is only effects the rendering and not the run phase.<br />
<br />
<strong class='bbc'>RPTDESIGN</strong>: This means e.g. the following (correct me please if I am wrong), abstractly speaking:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<birttable query="select some_bool from some_table"> <!-- "outer table query" -->
<detailrow id=1 visibilityHideRule="some_bool == 1" visibilityForOutput="all">
<td> <birttext> detail 1 content <birttable query="...subquery 1..." /> </birttext> </td>
</detailrow>
<detailrow id=2 visibilityHideRule="some_bool == 0" visibilityForOutput="all">
<td> <birttext> detail 2 content <birttable query="...subquery 2..." /> </birttext> </td>
</detailrow>
</birttable>
</pre>
<br />
Now let's assume the result of the outer table query is:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
some_bool
0
1
</pre>
<br />
and the outputted table rows will not be sorted in some way (to keep it easy).<br />
Which means we will get two rows outputted in the end ("rendered") ... no problem so far, but obviously 4 rows will get generated in the RUN phase ...<br />
<br />
<strong class='bbc'>RPTDOCUMENT/RUN phase</strong>=> the above will be transformed to something like the following:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<table>
<!-- processed 1st row (some_bool=0) of outer table query ... -->
<tr id=1 visibilityHideRule="0 == 1" visibilityForOutput="all">
<td> detail 1 content <table>...subquery 1.1 results...</table> </td>
</tr>
<tr id=2 visibilityHideRule="0 == 0" visibilityForOutput="all">
<td> detail 2 content <table>...subquery 2.1 results...</table> </td>
</tr>
<!-- processed 2nd row (some_bool=1) of outer table query ... -->
<tr id=1 visibilityHideRule="1 == 1" visibilityForOutput="all">
<td> detail 1 content <table>...subquery 1.2 results...</table> </td>
</tr>
<tr id=2 visibilityHideRule="1 == 0" visibilityForOutput="all">
<td> detail 2 content <table>...subquery 2.2 results...</table> </td>
</tr>
...
</table>
</pre>
<br />
<br />
<strong class='bbc'>HTML/PDF/RENDER phase</strong> the above will be finally transformed to something like the following:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<table>
<tr id=2 >
<td> detail 2 content <table>...subquery 2.1 results...</table> </td>
</tr>
<tr id=1 >
<td> detail 1 content <table>...subquery 1.2 results...</table> </td>
</tr>
...
</table>
</pre>
<br />
<br />
<strong class='bbc'>My problem here is</strong>:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>subquery 1.2</pre> and <pre class='_prettyXprint _lang-auto _linenums:0'>subquery 2.1</pre> are executed and processed (which may take a long time depending on your special report) although we know already in the RUN phase that they will never be output :-(<br />
<br />
Is there a straight forward way to handle that or is this more like a BIRT feature/bug?<br />
<br />
The only feasible but ugly solution I can see so far is to use scripting and explicitely coding the "visibility" into the subqueries with something like <pre class='_prettyXprint _lang-auto _linenums:0'>select ... where 1 = :visible</pre>.<br />
So the DB optimizer should not spend much time to execute the query if it is <pre class='_prettyXprint _lang-auto _linenums:0'>select ... where 1=0</pre>.<br />
<br />
Kind regards<br />
Andreas :-)<br />
<br />
-- <br />
I am using BIRT 2.6 (Eclipse Helios) and try putting this out to some PDF.
Find more posts tagged with
Comments
Hans_vd
Hi Andreas<br />
<br />
<br />
<blockquote class='ipsBlockquote' ><p>...or is this more like a BIRT feature/bug?<br /></p></blockquote>
Not wanting to see the data, is not the same as not wanting to get the data. I can perfectly imagine some situations where you have 2 tables based on 1 dataset, where you want one of the tables to be displayed and the other one hided. So I'd say feature, not bug<br />
<br />
<blockquote class='ipsBlockquote' ><p>The only feasible but ugly solution I can see so far is to use scripting and explicitely coding the "visibility" into the subqueries with something like <br /></p></blockquote>
As far as I can see, the results of the outer table are coming from a query. Passing the result of a dataset to input parameter of another dataset is a very common way to achieve this kind. Not ugly at all:-)<br />
<br />
Hope this helps<br />
H.
andreas2
Hi Hans,<br />
<br />
thanks for the quick reply.<br />
<br />
Regarding the "visibility"/hide/all: I also see it more like a feature than a bug, but it does not what I would expect from it in the first place.<br />
<br />
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="68950" data-time="1285931366" data-date="01 October 2010 - 04:09 AM"><p>
As far as I can see, the results of the outer table are coming from a query. Passing the result of a dataset to input parameter of another dataset is a very common way to achieve this kind. Not ugly at all:-)<br /></p></blockquote>
<br />
Maybe we misunderstood here since it's still ugly in my opinion when you still generate the always hidden content with the difference, that some sub table(s) do not have entries where they had before. <br />
<br />
before with visibility settings always disabled for tr (regarding RPTDOCUMENT/RUN results):<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><t1> <tr hideForAllOutputs="true"> foo bar <t1.1> ... 200 data rows with headings, subcontents etc.</t1.1> </tr> bla blu </t1></pre>
<br />
ugly workaround that only fixes the long running t1.1 query:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><t1> <tr hideForAllOutputs="true"> foo bar <t1.1> ... 0 data rows still with headings </t1.1> </tr> bla blu </t1></pre>
<br />
what I would like to see if hide is set to true for all outputs (in this case for my tr):<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><t1> </t1></pre>
<br />
Regards<br />
Andreas :-)
thuston
You need to Filter sooner so the section is not created.
Setting to not Visible can be conditional on the output format. Even when you select 'Hide for all' it assumes you have some reason for allowing the data to be used in the table.
andreas2
<blockquote class='ipsBlockquote' data-author="'thuston'" data-cid="68960" data-time="1285939682" data-date="01 October 2010 - 06:28 AM"><p>
You need to Filter sooner ...<br /></p></blockquote>
<br />
... and this means ugly workarounds so far I can see it :-/<br />
<br />
Maybe I should explain what I do and that this is not some extraordinary use case...<br />
<br />
Monitoring report for machines with a structure like this:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
- machine 1
- CPU Usage (includes some text, a chart, some aggregated values)
- Memory Usage (same as above)
- Swap Usage ...
- Network Usage ...
- DB Usage
- DB Instance 1
- Tablespace Usage
- Tablespace 1
- ...
- DB Memory Usage
- ....
- DB Instance 2
- ...
- ...
- machine 2
- ...
- ...
</pre>
<br />
the design is as follows (abstract):<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<table querySelectColumns="machine|usage group">
<!-- query: for machines and their **** Usage groups (only "DB Instance Usage" is optional for a machine) -->
<grpcol level=1 groupby="machine">...machine name...</grpcol> <!-- *workaround 1 -->
<grpcol level=2 groupby="usage group" hide="usage group != 'Memory Usage'>...memory usage details...</grpcol>
<grpcol level=2 groupby="usage group" hide="usage group != 'CPU Usage'>...memory usage details...</grpcol>
<grpcol level=2 groupby="usage group" ...
...
</table>
</pre>
workaround 1: i need the groups for a nice hierarchical PDF content map generation, but could also use a detail row otherways<br />
<br />
So the various queries in the grpcol level=2 levels are heavy and should not be executed if not output.<br />
<br />
If you know a better way to solve my problem any help would be much appreciated - I may be already blind for a straight forward solution :-)<br />
<br />
Kind regards<br />
Andreas :-)<br />
<br />
<br />
PS: Another bad thing (it would be another topic) is that with this implementation the filters I sat on the lower levels only work in memory and are not automatically applied to the query itself (I know this is not easy from the framework perspective). So I already had to do some scripting (which I don't like due to maintainability) to filter the data on the query level. Imagine some hundred machines and all their data processed by BIRT in memory and queried again and again due to sorting, filtering, grouping, aggregation ...
thuston
Can you zip and post your design? I'm not getting why you need so many groupHeaders but only show one.
Does each have its own nested Table with unique query? Isn't it possible to parameterize the nested query and only have one GroupHeader row?
andreas2
<blockquote class='ipsBlockquote' data-author="'thuston'" data-cid="68974" data-time="1285944637" data-date="01 October 2010 - 07:50 AM"><p>
Can you zip and post your design?<br /></p></blockquote>
<br />
Unfortunately I can't post it due to its customer value. If it would be really necessary I could prepare and post a skeleton version of it, but I don't think it's necessary right now.<br />
<br />
<blockquote class='ipsBlockquote' ><p>
I'm not getting why you need so many groupHeaders but only show one.<br /></p></blockquote>
<br />
I explained it in the workaround above: the PDFs content pane (left side in most viewers) can be hierarchically nested:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
- machine 1
+ Memory Usage
+ Network Usage
+ ...
+ machine 2
+ machine 3
</pre>
<br />
BIRT only generates this hierarchy in PDFs on table groups. That's the only reason...<br />
<br />
<blockquote class='ipsBlockquote' ><p>
Isn't it possible to parameterize the nested query and only have one GroupHeader row?<br /></p></blockquote>
<br />
But then I think the problem is still the same with multiple detail rows and their different visibility.<br />
Of course I could have all the different subsections in one outer detail row. If there would be no database on a machine the query should return fast in the optionally hidden DB Usage section and the whole thing would be solved.<br />
But in the end we want all the advantages ... nice PDF content pane and reasonably fast running report.<br />
<br />
Maybe everything would be easier if I have a look how to solve the PDF content pane problem via scripting if possible. :-)<br />
<br />
<blockquote class='ipsBlockquote' ><p>
Does each have its own nested Table with unique query?<br /></p></blockquote>
<br />
Yes. Highly individual content.<br />
<br />
Regards<br />
Andreas :-)