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