Home Analytics DevShare
The community of Analytics developers are invited to follow and participate in the developer network.
OpenText technical experts collaborate with supported customers and partners in the Magellan product area.

Changing a data set

edited June 26, 2013 in DevShare
Some times it is necessary to define or change a query associated with a data set based upon a report parameter or something passed in the reportContext. This example shows two different approaches to changing a query.<br />
<br />
Approach 1:In the data set's Property Binding, define a query based upon values passed into the report. In this example, the following script is used to define the query with or without a where clause based upon a parameter value
if(reportContext.getParameterValue("QueryParam") == "false"){
"where CLASSICMODELS.CUSTOMERS.COUNTRY in ('France', 'Spain', 'Germany')"}
else {
<br />
Approach 2:<br />
In the data set's beforeOpen event, define a script that can either modify or define the query. Unlike the first approach, here you have access to the full query and can modify it however you'd like. Keep in mind that you will need to ensure that you are still returning everything necessary for the data set's output columns. This example uses the following script in the beforeOpen event to modify the query:<br />
//Notice you can access a report parameter value using either:
// params&#91;"CountryParam"].value
// or
// reportContext.getParameterValue("CountryParam")
if(params&#91;"CountryParam"].value != null &amp;&amp; params&#91;"CountryParam"].value != ""){
 this.queryText = this.queryText +
    reportContext.getParameterValue("CountryParam") + ")";
Sign In or Register to comment.