Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Designing Analytics Reports
Evaluate Birt report params in regex
Migrateduser
Hi,<br />
<br />
I've created report with one string parameter named pUsername<br />
<br />
<br />
data set query look like <br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>select *
from users
where (users.username = :pUsername or :pUsername = 'admin')</pre>
<br />
to avoid using dataset parameters and mulitple usage of ?<br />
<br />
I've created dataset script on beforeOpen<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.queryText = this.queryText.replaceAll(":pUsername", params["pUsername"]);</pre>
<br />
and it works, but i want make more general solution when query contains couple params.<br />
<br />
When I chage code beforeOpen data set to<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.queryText = this.queryText.replaceAll(":(\\w*)", params["$1"]);</pre>
<br />
Expression fails and also<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.queryText = this.queryText.replaceAll(":(\\w*)", "params[\"$1\"]");</pre>
<br />
parameter expression is not evaluated and query fails.<br />
<br />
<br />
If I could use something like Eval(params["$1"]) in expresson above, it will bee great.<br />
<br />
Baki<br />
<br />
Thanks
Find more posts tagged with
Comments
There are no comments yet