Conditional Query – Using Parameter Value in the Query to Fetch Data

Home  >>  Jaspersoft Studio  >>  Conditional Query – Using Parameter Value in the Query to Fetch Data

Conditional Query – Using Parameter Value in the Query to Fetch Data

25
Aug,2014

1

I checked this question from Jasper Community Question how to use ” select top x records from table” in jaspersoft studio and thought this can be achieved by using Conditional Query. So I took the same report which I had used in my and modified it to achieve the required result.

I created 2 Parameters.
1) To accept user input at the runtime.
2) To use that input in the query to fetch the result.

Parameter 1 : DQ User Input is a visible parameter to collect user data.

QQ_Img13

Parameter 2: Will have the Query with DQ Input parameter value as the TOP Condition.

QQ_Img14

The Data Query for the report would be as same as explained in my previous Blog

Now when we preview, the DQ User input Parameter will ask for the TOP Value. Here I have given 5

QQ_Img15

Then the report will display Top 5 Records of ShipCountry.

QQ_Img16

One Comment so far:

  1. Magezi Sagesse says:

    Hello, I am using php to developp an application. When it comes to look for a reporting tool I found google proposing to use Jaspersoft but on some website they are showing how to use it with javabrigde and visiting this website I see php client I don’t know what to choose but still my big problem is I want the system to allow filtering,searching. In my understanding that will need passing custom sql string.

    So my question is is that possible with jaspersoft ? Is there any documentation that can show me how to do it?

Leave a Reply

Your email address will not be published. Required fields are marked *