Need help in report's dataset - jasper-reports

I'm using iReport Professional 5.1.0. I already used one query (some select query) in report query. But i need to use multiple queries in same report. So i tried with dataset. After creating dataset (Report Inspector -> right click Add Dataset), I've created different query. But i cant get any parameters (which is assigned to parent query column) to the newly created dataset.
My doubt is whether the dataset is applicable only to table, chart and crosstabs. If no, then explain step by step procedure to use dataset in iReport.

Parameters should be in each datasets so just copy the parameters from parent dataset and paste it in all the datasets and when you use any sub dataset for any chart, table or crosstables just pass all parameters and Expression for that parameter.

Related

Generate table report using sql joins in iReport

SELECT a.CIVIL_ID,a.PAT_NAME,a.SEX,a.PAT_NAT_CD,a.BIRTH_DT,a.ADDR,a.MOBILE_NO,b.FILE_NO,b.CREATED_DATE
FROM PAT_MST a
JOIN PATIENT_FILE b ON (a.PATIENT_ID = b.PATIENT_ID)
AND( b.HOSP_DEPT_SEC_SERIAL = $P{P_HOSP_DEPT_SEC_CD})
AND a.SEX = DECODE($P{P_GENDER},'ALL',a.SEX,$P{P_GENDER})
AND TRUNC(B.CREATED_DATE)>= TO_DATE($P{P_FILE_CR_DT_FROM},'DD/MM/RRRR') AND TRUNC(B.CREATED_DATE) <= TO_DATE($P{P_FILE_CR_DT_TO},'DD/MM/RRRR')
I am using this query to generate a table report in iReport(5.6.0), but for some reason I am only getting the column headers but this query is returning records when I run on toad.
Please tell where I am wrong..
Are you using Table report element? If so, you are using not the main dataset but some other subdataset. You should transfer parameters values from the main dataset to the one of which your table "feeds".
Add to your subdataset a parameter for an every parameter, used in main dataset.
Right click on your table Edit table dtasource->select Parameters tab->click Add.
In the Add/modify parameter window select your subdataset parameters in the upper menu. In the lower menu select their values (correspondent parameter from main dataset). Do this for an every parameter.

Passing values from main report to subreport in JasperReports

I have a simple select sql query with 2 parameters that I want it to be in my query text in main report. It returns about 100 values that I want to put in 10 subreports (10 values per subreport). On main report I need to display only one parameter. All the values from query I need to be in subreports. How do I pass them?
Connection to database is returned to me from application, parameter values also. I'm using iReport 4.7.0.
Parameters are attached to the dataset, if you expand the dataset itself, you'll find a section there for parameters, just like in your main report.
You'll need to link the parameters together though, using the connection properties where you're actually using the dataset, eg, in a chart or a table. For example, in the table, you go to the dataset tab of the properties pane, and click on the parameters button to map the parameters between your main report and your sub dataset.
More here.

Joining two datasets to create a single tablix in report builder 3

I am attempting to join two datasets in to one tablix for a report. The second dataset requires a personID from the first dataset as its parameter.
If i preview this report only the first dataset is shown. but for my final result what i would like to happen is for each row of a student there is a rowgrouping (?) of that one students modules with their month to month attendance. Can this be done in report builder?
The best practice here is to do the join within one dataset (i.e. joining in SQL)
But in cases that you need data from two separate cubes(SSAS) the only way is the following:
Select the main dataset for the Tablix
Use the lookup function to lookup values from the second dataset like this:
=Lookup(Fields!ProductID.Value, Fields!ID.Value, Fields!Name.Value, "Product")
Note: The granularity of the second dataset must match the first one.
We had a similar issue and that can be resolved this way.
First of All, ensure the first data set's query and second data set's query are working fine by executing separately on the Database client tool such as Datastudio.
Build two data sets on SSRS tool with the respective queries and make sure both the data sets have same key column (personID).
On the SSRS report design, create a table from tool box and add the required columns from the first data set along with the matching key column(personID). Add a new column and use look up function to get the required column from the other data set against the same key column (personID).

Two SQL query inside single JasperReport

We are generating reports based on iReports and JasperReports for web application.
Using iReports I found I am struck with big problem.
I want to use two SQL query to fill up my main report...
In query designer I can only write one query..
For another query I cannot use sub-reports...
How do I write second query which will return different fields and include them in my report..
Please guide...
I cannot use sub-reports...
Yes, adding a table to your report is as easy as adding a field. Just drag it from the palette and drop it in the report where you need to have it.
Add a new Table data source. I assume this was done.
Once the data source is configured, you could design your table UI using the wizard.
just click on next or finish to close the wizard.
To add a parameter in data set (if needed), Navigate to your data set using the report inspector. Expand your data set. You would find the parameters menu. Right click to add the new parameter.
Now right click on your table and select edit table data source. Here you will find options to pass parameters to your table from the main report. Passing parameters to your table should be as simple as you do in sub reports. Select the parameter just created from the drop down list box and pass the required value.
In the Data set run Dialog box that appears, please make sure of the data set and the report connection you are using.
You are done configuring the table with this, next you will place the fields in the cells of table for displaying the data.
You are getting your document has no pages since the main report query does not return any rows i guess. For your table to be executed your main report must return at least a row
Hope this helps you.
Good Luck!!
As far as Ireports are concerned, the main report can comprise only one query. And if you wanna use multiple queries in your report, it is possible in the following ways.
Sub Report
Table Dataset.
sub Dataset.
since you don wish to use a sub report, you can go for a Table Dataset. Anything you would do with a sub report is possible with table dataset too(Except for returning variables). You can use sub datasets with charts and graphs. Table set will be of use to you i hope.

How to filter in records from one dataset to another?

I am developing an SSRS 2008 report. I created one dataset to give me the records I want. I also created a different dataset that determines access based on security profiles of the person running the report. What I want to do now is join the results of this second dataset with those of the first dataset in T-SQL. So I would like to perform this join within the T-sql sproc for the first dataset. How do I do this? Note that in most cases the results of the second (security) dataset is more than one record.
Are both datasets coming from the same database? You can probably wrap this logic in a stored procedure instead.