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)
Dynamic Filters using IDAPI
grather
<p>I have a need to be able to have different filters on a query</p><p>for example</p><p> </p><p>myvalue is null</p><p>or</p><p>myvalue = "1234"</p><p>or</p><p>not even ave a filter</p><p> </p><p>I have just found out about Dynamic Filters and this seem to be what will solve my problem.</p><p>If I was actually running from the iHub server works great.</p><p> </p><p>But I am using IDAPI using the ReportExecutor object to run this from my application I am working on an integration.</p><p> </p><p>But using String objId = reportExecuter.executeReport("/Applications/"+rptFullName,null,parameters );</p><p> </p><p>I know how to pass in parameters. But what do I need to do to pass in a Dynamic Filter.</p><p> </p><p>Seems like I need to pass the parameter , operator and the value.</p><p> </p><p>But I am not sure. Can you guys help.</p><p> </p><p>Gary Rather</p>
Find more posts tagged with
Comments
grather
<p>For those who might see this. I figured it out with some scripting help.</p><p> </p><p>What I did was first create a Dynamic Filter on a report.</p><p>I also found some scripting for debugging. Which helped .</p><p> </p><p>First to debug add a Dynamic Text field to a report. then the script is</p><p>I figured out the dynamic filters.
It took a bit of debugging but with the help of some scripts from DevShare I was able to figure out how to use Dynamic Filters.
So to be able to have my filters added I needed to know how.
So what I did was first add a dynamic Text field to my report.
and use this script to log the parameters and show the name and value.
Here is the Script.
var output = " **** ";
var paramVal = "";
var pList = reportContext.getDesignHandle().getAllParameters();
var pListSize = pList.size();
for (i=0; i<pListSize; i++){
var paramName = pList.get( i ).getFullName();
var paramType = pList.get( i ).getStringProperty("paramType");
if (paramType == "multi-value"){
paramVal = reportContext.getParameterValue( paramName ).join(", ");
}
else{
paramVal = reportContext.getParameterValue( paramName );
}
output = output + '-' + paramName + '=' + paramVal + " - n";
}
output;
So then just run the report from iHub and I ended up with getting the input parameters.
1) for is null filter
attr1=ISNULL([ATTRIBUTE1])
2) for a equal to
([ATTRIBUTE1] = "My Value")
So with this I was able to then know what to pass to the report.
With all this now my IDAPI code to pass in parameters
HashMap<String, String> parameters = new HashMap<String, String>();
parameters.put("attr1", "([ATTRIBUTE1] = "My Value")");
String objId = reportExecuter.executeReport("/Applications/Comments.rptdesign", null, parameters);</p><p> </p><p>Hope that helps.</p><p> </p><p>Gary</p>
mwilliams
<p>Thanks again for updating your thread with your solution. This would probably be another good devShare post for easier searching by others.
</p>