SSRS dynamic data retrieval from another dataset - reporting-services

I want to get data(dynamic) according to the data in another dataset and put the result in textbox of the different dataset.
Right now, the data I get is static and I tried to use many expressions but no avail.
Problem lies in editing textbox expression. Since I am getting data from different dataset, it always ask me to have dataset aggregate function in my expression. If I specified the dataset from where I am getting the data, then, I cannot make it dynamic - and I get the undesired result.
And another way out that I attempted is merging the data sets into one rather than having multiples and use it only but this was unsuccessful.
How can I make it work to get the result that I want:
By the way, the textbox and the tables are in different scope. I have tried to combine them in one scope too.

Getting data from another dataset requires an aggregate function because it can't tell what data you want from that dataset so it forces you to aggregate it so it can return a specific value rather than an entire list of values.
I think what you are after is the Lookup function. Lookup allows you to look up a value from another dataset based on a value in the table's dataset. To give a simplistic example, let's say your table was of employees and you had a department id on that table and another dataset called "Departments" which had an id and a name. You could look up the department's name using the following expression:
=Lookup(Fields!DeptId.Value, Fields!Id.Value, Fields!Name.Value, "Departments")
This uses the current table's dataset's DeptId field to look up the Departments dataset by the Id field and return the Name field.

=Lookup(First(ReportItems!EmpID.Value),Fields!EmpID.Value,Fields!Dept.Value,"dataset_which_u_retrieve_the_data_from")
Problem solved!By using reportItems instead of Fields because I am retrieving one data only,not the whole field.
Thanks guys for helping me out.

Related

SSRS Compare Two Datasets For Missing Ids

In SSRS report I have two data sources from two different servers. I have a dataset for each data source and would like to return in a tablix the ids that are in dataset 1 but not in dataset 2.
So if dataset 1 has ids 1,2,3,4,5 and dataset 2 has ids 1,2,3 the report should display 4 and 5. I cannot link the servers. Thanks.
There are several ways to do this.
Common Lookup method
This is the way most people would probably do this
Use the Lookup() function.
Set the tablix row's hidden property to something like
=ISNOTHING(
Lookup(Fields!IDa.Value,Fields!IDb.Value,Fields!IDb.Value,"Dataset2")
) = False
The above, for clarity, assumes the ID column in dataset1 is called IDa and the ID column from dataset2 is called IDb. It will stil work if they have the same name (e.g. 'ID')
Note: Dataset name must be in quotes and is case sensitive.
Using this method returns all the rows and simply hides the ones that do not match your criteria. This may not be ideal if you're exporting the data. If not, see the alternative version below.
Alternative method
For reasonably small datasets - parameter method
... and because I thought it was an interesting approach...
This second method uses a hidden parameter and is easy to setup assuming you have a reasonable small number of records.
Using your example, create a parameter called List2 and set its default and available values BOTH to your Dataset2 query (from your example above). Make the parameter multi-value. You can make this parameter hidden once it's working.
Now Your Dataset1 query can be a simple query like this,
SELECT * FROM Table1 WHERE id NOT IN (#List2)
#List2 will contain the values from datset2 (1,2 and 3) so the query will return only the remaining values.
Note I named the datasets to match your example but the datasets must be created in the order above.

How to customize TaxReport_IT - report SSRS?

I would like to custom the Report SSRS TaxReport_IT, I need to add a new field in order to use in to SyntethicReport Design.
(for example)
The classes involved seems these:
TaxReport_IT
TaxReportDP_IT
TaxReportController_IT
TaxReportContract_IT
Tables involved:
TmpTaxReport_ITSummary
TmpTaxReport_IT
TaxReportTmp_IT
Are there others? Are there some Queries involved?'
I added the new fields in to table _TmpTaxReport_IT_, and I pupulated the related tables
I'm sure, in to the method I pupulated correctly the new Field (I have the values ​​that I expect), but when I print the Report I get a lower value. Seems like I don't take the total data set.
How can I add the new field and take the correctly total value?
I saved the data (about my custom field in a RegularTable) and the sum is correct, but I have mismatch when I print the report.
I think I skip some step to Report DataSet.
I use Dynamics AX 2012.
Thanks in advice!
I have an idea what could be wrong, but I'm making some assumptions. If they are not correct, please edit your question to clarify.
From your screenshot, it looks like you want to add your new custom field in the header section of the report design. I'm assuming the expression of that field looks similar to
=First(Fields!MyCustomFIELD.Value, "TaxReportDS_IT")
Note the First key word in that expression. This indicates that the value for that field should be taken from the first of the records of the report's dataset.
I'm assuming that you calculate the value of the field while the records in table TaxReportTmp_IT are being created so that each record has a different value. Maybe it is a sum of some other field, so the first record would have the smallest value and the last record the highest.
If all those assumptions are correct, you can fix this by changing the First keyword to Last. This indicates that you want to take the value of the last record of the report data set.
See also the documentation of the Last Function.

Add filter option on each column of the data displayed in SSRS

I am generating a table in SSRS based on the selection made by the user on two filters: Filter1 and Filter2 (say). The table so displayed has 10 columns and I wish to add filter option listing all available values for that column for all 10 columns.
Basically, I am trying to replicate the Excel functionality of filtering down data on each and every column.
Please note that I tried creating a new data set and a parameter taking all distinct values for a particular variable. However, I am still not able to get the desired results by filter the tablix on that parameter
Is there a way I can do that?
You'd need to make a new dataset that is a smaller version of your main dataset. It would need to return all potential values for the column(s) you want to filter in a single column to be used in a parameter.
Without seeing the design of the report or the dataset itself it's quite hard to be more specific.

Get value of table row

I've got two tables binded to two different datasets. I'm trying to reference one of the rows from one of the tables (Table A) from Table B.
Since it's outside the scope of the table, I can't use ReportItems![Textbox name].Value
Any ideas?
You can use the SSRS Lookup() or LookupSet() function to retrieve the data directly from the other dataset.
I found the MSDN pages a bit unclear, the syntax goes like this:
=LOOKUP(Fields!sourceMatchingField.Value,
Fields!targetMatchingField.Value,
Fields!targetReturnField.Value,
"Name of Second Dataset"
)
Fields!sourceMatchingField.Value is from the dataset that is
currently in scope.
Fields!targetMatchingField.Value is from the other data set you need to get information from and equals Fields!sourceMatchingField.Value.
These two parameter values for the Lookup function make the join criteria for the two datasets. They can be more complicated than simply two field references (such as using functions to manipulate on or both), but I'm just showing the simplest way to do it.
Fields!targetReturnField.Value is the field from the second dataset that you want to return. This should just be a reference to a field.
"Name of Second Dataset" is just what you've named the other dataset that you're joining to.

Alternative to Lookup() function in SSRS

Currently I'm trying to display custom data per a unique key, like a person ID. For example, if I select an ID from a dropdown (a parameter), the data should be tailored to that ID. If I change the ID, the data should change with it. However, I'm using a Lookup() function for now since my report only returns the first row of data even if I change the ID. I've tried filters but haven't had luck. There should be an alternative to the lookup function. Any help?
Thanks.
Generally, the best way to accomplish this is with cascading parameters.
See here.
In short, have your initial visible parameter drive a lookup query, the values of which are used a parameters for the main query.