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)
How to access data set's parameters?
zlyLew
Hi.
I have this problem. I have this data set with 1 input parameter (tableName) that can be set to 2 values 'products' or 'product_hst'. Now based on this parameter I want to execute one of this queries:
select * from products
or
select * from products_hst.
My first idea was to use property binding "select * from ?". But it seems that birt parser doesn't replace ? mark with data set's params.
Is there other way to access parameters. Maybe there is something similar to param[] array ?
Waiting for yours response.
Find more posts tagged with
Comments
Hans_vd
Hi ZlyLew,<br />
<br />
BIRT does replace ? with data set's parameters.<br />
Since your parameter clearly is a string type parameter the query will be <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select * from 'products'</pre>
which is an invalid query statement<br />
<br />
What you could do is write query like this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select * from products where ? = 'products'
union all
select * from products_hst where ? = 'products_hst'
</pre>
Note that you need to bind the report parameter twice to the dataset, as you have two ?'s in the query.<br />
<br />
Hope this helps<br />
Hans