Jaspersoft BI Tools

iReport,Jaspersoft Design Studio,Jaspersoft Server, Schema Workbench,Analysis,Dashboards, Self Service BI, Domains,Topics,Ad-Hoc Reports, Jaspersoft ETL, Embedding BI,HTML-5 charts, Fusion Charts,JFree Charts,Drill down reports , Drill down Dashboards,Visualize.js, Performance Tuning, D3 Charts, Jaspersoft Customization

Thursday, April 07, 2016

Tip : How to pass a parameter of a ad-hoc report from URL - How to find the ID for the filter created in ad-hoc view ?

This post will help you in understanding how to identify the ID for the filter that is being created in Ad Hoc view and then in Ad Hoc Report.

Software used for this example/discussion is : Japsersoft Server Professional 6.2

Please click on the images that you find in this post for getting the best view

Some points :
1) We create Fields as filters in Ad Hoc Views (or in Ad Hoc views).
2) We can't identify the ID's for the filters in Ad Hoc Reports.
3) Usually we Edit the Report to view the Data Sources,Controls & Resources and etc.
4) When you click on Controls & Resources for the Ad Hoc views you can not find the filters over there because its not a studio report.
5) To identify the filter/parameter ID, we have to go and look into the Domain and have to see the ID there for the field (which we used as filter/parameter)
6) As we use the field twice in View it doesn't take the ID we found in Domain.
7) As of Jasper 6.2, it takes "field_id_identified_in_domain"_1, 
for example : 
sales_stage_1 where sales_stage is the ID identified in domain for "Sales Stage" label/field.

Lets understand the above points using screenshots. 
1) Domain used for this example (Simple Domain) - Available in Pro server
2) Sample View (Filter is : A.Sales Stage ) 
* "Sales Stage" is the label name for "sales_stage" field from "Simple Domain"

3) Writing Ad Hoc Report using above view and the filter used is "Sales Stage" field

4) Now, if you try "Edit" ing the report you can't find the filter available from Studio as well from Server. 

5) Identifying the  ID for the "Sales Stage" filter from domain ("Simple Domain" is the domain name
ID for "Sales Stage" filed from the domain is : sales_stage

6) After identifying the filter use this ID along with _1 (underscore 1) post fixed to it
Field ID = sales_stage 
(This is the original field name from database table while writing the domain, you can change it also by clicking on edit button)
Filter ID = sales_stage_1  (As "Sales Stage" label or you can say "sales_stage" filed is being used twice in view, you have to take underscore with 1 )

This is what I identified while exploring passing the ID for a report developed developed using Ad Hoc Views

NOTE: Reader is encouraged to add if he/she find any other alternative way in comments box.

7) Now use this ID (sales_stage_1) in URL 

For example 1: 

Example-2 : 

I hope this helps some one. !

If you find it useful, please hit the share button help the community.!

Sadakar Pochampalli