This is a short post about creating a successful IReport with Parameters. The idea is called 'Parametrized IReport'.
If you're familiar with the IReport it's alright, but if you're not then follow the previous posts I've noted down @ notesofharsha here.
Let's start creating a parametrized IReport.
1. Hope you're with IReport Application opened. Now, Go to Report Inspector in the left side of your application window & select 'Parameters'.
2. Right Click & Select Add Parameter.
3. Right Click & Select Rename to rename the parameter. You can give a name in the pop up box coming out.
4. Then, you've to adjust your MYSQL query in order to get your parameter passed into the output. So to do that, right click on the Report Name in the Report Inspector & click Edit Query.
SELECT order_table.`Ord_No` AS order_table_Ord_No, order_table.`Qty` AS order_table_Qty, order_table.`Order_Date` AS order_table_Order_Date, order_table.`Sup_No` AS order_table_Sup_No, order_table.`Prod_No` AS order_table_Prod_No, order_table.`Invoice_Date` AS order_table_Invoice_Date FROM `order_table` order_table WHERE order_table.`Ord_No`=$P{Order_No}
6. You've to correctly enter the exact name of your parameter in the WHERE clause.
7. After all, you've to test it. In order to do that, Click Preview in the tool bar right above your workspace.
8. Now, you'll be asked to enter parameters. Just Enter the correct parameters So that the Report will be shown accordingly.
9. Click 'Refresh' button to retest.
Enjoy !
No comments:
Post a Comment