Passing parameters from crosstab to subreport in jasper

Passing parameters from Crosstab report to drilldown report in Jasper Studio

Scenario: I have created a crosstab report and When user clicked on measure it should open a another details report by passing the same parameters being selected in crosstab report

Prerequisites:
Jasper Studio Workbench
Jasper Server
Database: Postgres – Foodmart

Main Report

  1. Created a cross tab report having Region and area as row groups, month wise store cost, sales units as measures with Region and Area as parameters

    crosstab1

  1. Created Region and Area parameters in main report section

    crosstabparam1

  2. Create same parameters inside the cross tab

    crosstabparam2

  3. While creating parameters in crosstab, if you are facing any issue then add parameters from source code

    <crosstabParameter name=”Region” class=”java.util.Collection”/

    <crosstabParameter name=”Area” class=”java.util.Collection”/>

    Drill Down Report

    1. Create a detailed report having few columns and add region, area and month as parameters

      drilldownCase: Whenever user clicked on a measure in the main report, it should take respective region, area and month values and it should render drill down report with selected values. 

      1. Add Hyperlink properties to measures in the cross tab main report

      Click on element, in properties pane click on hyperlink, change values of link target to blank and link type to reportExecution. Click on parameters and add parameters.

      Add drill down report path in _report and region, area and month parameters

      crosstabdrill

    2. Run the report in interactive mode and check click icon will be displayed on the measures and click on that. It should open drill down report

      crosstabhyperHyperlinks are displayed in blue color. Click on measure it will open drilldown report but selected input control parameters values are not passing from main report to subreportTo handle this case, we have to add one property in main cross tab report

      Click on crosstab element in outline pane, Open properties and click on crosstab

      There is one attribute named as Parameters Map Expression.

      Enter $P{REPORT_PARAMETERS_MAP} inside the expression

      crosstabprop

      Save and run the report.

      Now Click on measure hyperlink, it will load drill down report

      Main Report – Cross tab

      – Clicked on Sales column in January Month, CA area and USA Region

      crosstab1

      Drill down report

      – Getting January, CA and USA as parameters from the main report

      drilldown

Thanks,
Ramu Vudugula
BI Developer

Using Multi-select parameter in Jasper


Using Multi-select parameter in Jasper

Parameters can be the filter conditions which can be applied in the data-visualizations. This bog gives steps wise description of creating a multi-select parameter while developing report.

There are 2 different types of Parameters
1. Single select
2. Multi-Select

creating Parameter in Jasper Studio:

For Example there are employees in a department and a report generates the employee details department-wise. If the user wants to view employees from more than 1 department user can create multi-select parameter in that case.

Following are steps to create a parameter

step1: In the outline to the left side of the jasper studio we can find parameters. Right-clcik and create a new parameter.for eg: lets create a parameter with name “dept” and in the class definition we must give “java.util.Collection”, we can also give default values it is optional.

Capture1

step2: In case we are using sub-report or the table component we need to pass the same paraeter with same name to the sub-report/table. In the above example we are using table. Click on table in the table component and in the properties pane select dataset table u will find the following

Capture2

step3: Then add the parameter from main report to the table/subreport.
and click on finish.
Capture3

step4: Using the parameter in the query. following is the syntax for using multi-select parameter in a query.

where $X{IN,d.department_id,dept}
Capture4

Thanks
Asha Bidiyasar

Passing parameters from parent job to sub job/transformation in Pentaho Data Integration (Kettle) -Part 2

Passing parameters from parent job to sub job/transformation in Pentaho Data Integration (Kettle) -Part 2

In part 1, I have mentioned about passing parameter values down to sub-job/transformation using setter/getter methods.

Please refer my previous post for part 1 Passing parameters from parent job to sub job/transformation in Pentaho Data Integration (Kettle) -Part 1

But in this part we will use executor steps to do the same process.

Part 2 : Using job/transformation executor steps :

In order to pass the parameters from the main job to sub-job/transformation,we will use job/transformation executor steps depends upon the requirement.

Following are the steps :

1.Define variables in job properties section
2.Define variables in tranformation properties section
3.Configure job/transformation executor step

1.Define variables in job properties section :

Right-click any where on your job and select settings and go to parameters section.Define all the variables and assign some default values to each.

job_properties_pdi

2.Define variables in transformation properties section :

Right-click any where on your sub job/transformation and select settings and go to parameters section.
Use the same variables that you have defined in your parent job (i.e.Step1) and assign some default values to each.
transform_proeprties_pdi
3.Configure job/transformation executor step :

In this step,we have to configure sub job/transformation path details and need to pass the same parameters in job entry details section like below.

Double click on job/transformation executor step and provide transformation file path details.

transform_executor_config

Go to parameters section and make sure you have checked the Pass all parameter values down to the sub-transformation check box.

transform_executor_params

So now you can utilize same variables in your sub-transformation.

 

Thanks,

Sayagoud