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)
Script in beforeOpen
ajunuthula
Hi,
Is there a way where I can search for a specific string which is a parameter in the select statement.
For e.g.,
select * from table where name like '%apple%';
Assume the string "apple" is a parameter value.
Is there a way where I can run the query in Birt using dynamic parameter as,
select * from table where name like '%?%';
Can you please suggest.
Thank you,
Aparna J
Find more posts tagged with
Comments
kclark
ajunuthula,<br />
You can add a report parameter to your project named myParam then add some code like this to your data set (beforeOpen)<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
this.queryText = "select * from customers where customers.country like '%" + params["myParam"] + "%'";
</pre>
<br />
You could also build your query like normal and use a marker like<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
select * from table where name = '%myparam%'
</pre>
<br />
Then in beforeOpen you could replace the query like this<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
this.queryText = this.queryText.replace("myparam",params["myParam"]);
</pre>