How to filter in records from one dataset to another? - tsql

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.

Related

I have Crystal report and need to use results from parameter based on one table to run a parameter on another table

My SQL Table contains RmaNumber, RmaLineNumber and Warehouse, and then a whel lot of other details.
We want to filter (using a parameter) on warehouse to produce a list of RMANumbers and RMALinenumbers to choose from. The problem is that when I include the RmaLineNumbers it makes the dataset to large to display in Crystal Reports.
So I tried splittin the data into 2 tables - the first table contains the Warehouse and RMANumber. The second table contains the RmaNumber and RmaLine Number. The idea is that I put a parameter on the first table to select the warehouse and it returns a list of RMANumbers (a manageable size data set)Then the user will select which RMANumbers they want and from that list I want to filter (parameter) From the second table to see the line numbers (a smaller dataset) then the report will display the details based on the line number chosen. Is what I am trying to do possible in Crystal? is there another way around the issue of the dataset being to large?

Need help in report's dataset

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.

Multiple dataset for single tablix in ssrs 2008

I am working on ssrs which uses a table. I need to get values into the table from two dataset which comes from single datasource.
you can define the over all table data set to one of the data sets which is used maximum to pull in the values to the table. For columns which has to use the second data set, in the Expression properties window, select the Dataset from the Catogery list and then you can select the dataset name and the valuew associated with it.
If you're using SSRS 2008 R2 you can use the Lookup() function in an expression in your table to pull in values from other datasets based on a lookup key or other joinable field. Lookupset() would allow you to retrieve multiple records at once if you need to deal with a 1:many relationship.
See here for more:
http://technet.microsoft.com/en-us/library/ee210531.aspx
http://technet.microsoft.com/en-us/library/ee240819.aspx
This will not work if you're on plain old 2008.

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).

Reporting on multiple tables independently in Crystal Reports 11

I am using Crystal Reports Developer Studio to create a report that reports on two different tables, let them be "ATable" and "BTable". For my simplest task, I would like to report the count of each table by using Total Running Fields. I created one for ATable (Called ATableTRF) and when I post it on my report this is what happens:
1) The SQL Query (Show SQL Query) shows:
SELECT "ATABLE"."ATABLE_KEY"
FROM "DB"."ATABLE" "ATABLE"
2) The total records read is the number of records in ATable.
3) The number I get is correct (total records in ATable).
Same goes for BTableTRF, if I remove ATableTRF I get:
1) The SQL Query (Show SQL Query) shows:
SELECT "BTABLE"."BTABLE_KEY"
FROM "DB"."BTABLE" "BTABLE"
2) The total records read is the number of records in BTable.
3) The number I get is correct (total records in BTable).
The problems starts when I just put both fields on the reports. What happens then is that I get the two queries one after another (since the tables are not linked in crystal reports):
SELECT "ATABLE"."ATABLE_KEY"
FROM "DB"."ATABLE" "ATABLE"
SELECT "BTABLE"."BTABLE_KEY"
FROM "DB"."BTABLE" "BTABLE"
And the number of record read is far larger than each of the tables - it doesn't stop. I would verify it's count(ATable)xcount(BTable) but that would exceed my computer's limitation (probably - one is around 300k rows the other around 900k rows).
I would just like to report the count of the two tables. No interaction is needed - but crystal somehow enforces an interaction.
Can anyone help with that?
Thanks!
Unless there is some join describing the two tables' relationship, then the result will be a Cartesian product. Try just using two subqueries, either via a SQL Command or as individual SQL expressions, to get the row counts. Ex:
select count(distinct ATABLE_KEY) from ATABLE
If you're not interested in anything else in these tables aside from the row counts, then there's no reason to bring all those rows into Crystal - better to do the heavy lifting on the RDBMS.
You could UNION the two queries. This would give you one record set containing rows from each query once.