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)
Parameters with lookup and attribute names
CalilJorge
Hello!<br />
<br />
I have a problem with reporting parameters using Birt & IBM Maximo. I want to create a parameter with a lookupname and an attributename.<br />
<br />
I have to type the parameter location, but I want to use the lookup "locations"<br />
<br />
I use this way to create the where param clause<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if (params["location"].value){
where = where + " AND " + MXReportSqlFormat.createParamWhereClause("UPPER(location)", reportContext.getParameterValue("location").toUpperCase());
}
</pre>
<br />
And, I used the lookup locations and the attribute name location. Then, when I select the parameter to preview the report, it returns nothing! I tried to create the where param clause in many ways, but I think it's just a little detail to make it work.<br />
<br />
Can someone help me please?<br />
<br />
My best regards!<br />
Calil.
Find more posts tagged with
Comments
mwilliams
Hi Calil,
What is the value of the location parameter? Also, what does the rest of your query/where statement look like?
CalilJorge
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="66982" data-time="1280848926" data-date="03 August 2010 - 08:22 AM"><p>
Hi Calil,<br />
<br />
What is the value of the location parameter? Also, what does the rest of your query/where statement look like?<br /></p></blockquote>
<br />
Hi, Michael,<br />
<br />
Actually, my query is really big, but I have a small test. I can't do a small test with<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
maximoDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName());
maximoDataSet.open();
var sqlText = new String();
var where = params["where"];
if (params["location"].value){
where = where + " AND " + MXReportSqlFormat.createParamWhereClause("UPPER(location)", reportContext.getParameterValue("location").toUpperCase());
}
sqlText = "select location from locations where " + where;
maximoDataSet.setQuery(sqlText);
</pre>
<br />
The main problem here is: when I leave the location filter only as a simple text field, without the lookup name, and type it myself, it does work perfectly. But when I use the parameter with the lookupname and the attributename, the report doesn't return anything.<br />
<br />
Did you understand my problem?<br />
<br />
Thanks!
mwilliams
What does MXReportSqlFormat.createParamWhereClause("UPPER(location)", reportContext.getParameterValue("location").toUpperCase()); return?
One thing you could do to check to see what you're sending to your database as your query would be to store your queryText to a variable and output it to your report so you can see it. This will usually show you what you're doing wrong.
CalilJorge
Michael, I tried to do this, but it appears that occurred something wrong with the sql query.
Do you know another way to see what the MXReportSqlFormat.createParamWhereClause() returns? Maybe write it to a file, its possible?
CalilJorge
I got it!!! Thanks a lot for your time!
I knew it was only a small detail. Here is the code I used:
if (params["location"].value){
cond = " AND " + MXReportSqlFormat.createParamWhereClause("location", params["location"]);
}
Easier than I thought! Now I can even allow multiple values in the filter.
Regards!
Calil.
mwilliams
Are you trying to run this report within Eclipse or within Maximo? What are you doing to try to capture the query text and display it to the report?