Passing input paramters dynamically to Quey in BIRT report
Hi All,
I have a requirement where I need to append the query dynamically based on the input parameters value.
I am trying the below method, but doesn't work
In DataSet open method
testDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName()); testDataSet.open(); var sqlText = new String(); sqlText = " SELECT id, status,job,site from workorder " + " where " + params["where"] + "siva" ; maximoDataSet.setQuery(sqlText);
in beforeOpen method of Dataset I am trying replace the text siva **in the query dynamically based on input parameter, but it is giving error
**cannot call method 'replace of undefined". Please help me, how can I do it?
//beforeOpen codesqlText = this.sqlText.replace("siva", "AND STATUS = " + params["site"]);
Thank you!!
Answers
-
This is what I do
maximoDataSet = MXReportDataSetProvider.create(this.getDataSource().getName(), this.getName()); maximoDataSet.open();
var myWhere =""; "
if(BirtStr.toUpper(params["etonum"].value)) { myWhere =" AND prl.etonum LIKE '"+ BirtStr.toUpper(params["etonum"].value) + "%'" }
Then in the SQL statement I just add
``sqlText = "Select .............- " AND " + MXReportSqlFormat.createParamWhereClause("pr.siteid", params["site"].toUpperCase())
+ myWhere``
I have also used this when I alias a Maximo table name
var myWhere = params["where"].replace("matrectrans","m");
I am not sure the **THIS **works correctly for the BIRT that Maximo supplies if you are using their class files, although I have never tried it
1 - " AND " + MXReportSqlFormat.createParamWhereClause("pr.siteid", params["site"].toUpperCase())
Categories
- All Categories
- 109 Developer Announcements
- 49 Articles
- 100 General Questions
- 122 IM Services
- 40 OpenText Hackathon
- 31 Developer Tools
- 20.6K Analytics
- 4.1K AppWorks
- 8.9K Extended ECM
- 897 Cloud Fax and Notifications
- 77 Digital Asset Management
- 9.3K Documentum
- 29 eDOCS
- 123 Exstream
- 39.8K TeamSite
- 1.7K Web Experience Management