How to Write SQL Query in Parameter and Use it in Main and Sub Datasets

Posted on by By Satya Gopi, in Databases, Jaspersoft | 0

Prerequisites: Jasper Server 6.4.2

Database: Foodmart

In this blog, we will learn how we can write an SQL query in parameter and use in Main Dataset or Sub Datasets.

  1. Created a sample query which as follows and created a report in jasper server

select full_name,position_title,hire_date,salary from employee where “position_title” =’President’

union

select full_name,position_title,hire_date,salary from employee where “position_title” =’VP Country Manager’

Output as:

SQL Query in Parameters

 

 

 

 

 

 

 

2. Now we will write the below query in parameter and use in the main dataset

select full_name,position_title,hire_date,salary from employee where “position_title” =’VP Country Manager’

The above query we need to write in parameter default expression

SQL Query Parameters

 

 

 

 

 

 

 

 

 

 

3. Use this parameter in the main dataset

parameter in the main dataset

4. Deploy the Report and check the output

5. Output

SQL Parameters Final Output

 

 

 

 

 

 

 

 

 

logo

Best Open Source Business Intelligence Software Helical Insight is Here

logo

A Business Intelligence Framework

In case if you have any queries please get us at support@helicaltech.com

Thanks,

Satya Gopi

Helical IT Solutions Pvt Ltd

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments