Hi I am trying to construct SSRS report using multiple datasets. The report is about hotel details like hotel id, name, city, link to website and hotel specific details. Below is the screenshot of datasets:
BackupReport contains the hotel id, name, city, etc and BackupSubReport contains other hotel specific metadata.
Below is my report Design layout:
Now when I preview the report, I get hotel id, name and city for all hotels first, then hotel links for all hotels and then finally the hotel metadata like below:
The actual report should look like this:
Any idea on how to fix that. I am new to SSRS so not much familiar with all the design specifics. I checked this post here but that is about a specific function. I read about lookup and multilookup functions but not sure how can I apply them here to fix my issue?
Any comments will be helpful.
Well, your desired result is in SSRS normally a subreport, where you have in the main report all hotel Id´s and if you click one id you go to the subreport with the detaildata (like in your picture).
In SSRS you normally have all data for one hotel id in one row. If you have two datasets, you combine the data with Lookup(). Put a tablix in your report and add in the first two textboxes the fields Hotel ID and Vendor Name from the dataset BackupReport:
'Data from DataSet1
| APA-HotelParsing_HotelID | VendorName |
'Data from DataSet1 combined with DataSet2
| APA-HotelParsing_HotelID | VendorName | GoogleValue |
To get Google Value write the following expression in the third textbox:
=Lookup(Fields!APA-HotelParsing_HotelID.Value, Fields!APA-HotelParsing_HotelID.Value, Fields!GoogleValue.Value, "BackupSubReport")
Apply the lookup step again and get all your data in one row.
If you dont want to work with subreport and just display the data like in your picture you can do a workaround and put all data in one textbox. Thus it will look like your pictire. You have to write a expression like this in the tablix detail textbox:
="Hotel ID: " & Fields!APA-HotelParsing_HotelID.Value & Space(10) &
"AA Hotel Name: " & Fields!VendorName.Value & Space(10) &
"City Code: " & Fields!CityCode.Value & VbNewLine &
Lookup(Fields!APA-HotelParsing_HotelID.Value,
Fields!APA-HotelParsing_HotelID.Value,
Fields!GoogleValue.Value, "BackupSubReport"
)
And so on... This way you get all information in one textbox and because it is in the detail section it will get automatically repeated for each row.
Related
I have a very nice admin matrix report "Report Users by Site" that you can drill down from Site, to Category, to Report name.
Where is shows a report was run 7 times yesterday (for example) I would like to hover over that '7' and get a list of the 7 users who ran that report.
I can do [=Fields!UserName.Value] which races through the 7 names displaying just the last one. I tried Split etc with no luck.
Any ideas ?
You can use join() to join a list of things together. For the tooltip on the textbox, use something like:
=join(lookupset(Fields!Row.Value & "|" & Fields!Column.Value, Fields!Row.Value & "|" & Fields!Column.Value, Fields!Value.Value), ", ")
In this example, Fields!Row.Value is what my row is grouped on, and Fields!Column.Value is what my column is grouped on.
I've got two tables that contain the following.
Table Name: Enquiries
ID
Username
Date of Raising
Time of Escalation
Invoice
Repeat Contact
Query Type
Context of Query
DC
Table Name: PC
PCID
PCarea
Town
DCArea
DCName
I currently have a Form setup with the above fields all selected. I have PCArea setup as a drop down as the field has 2000+ records (Postcodes). What I want is when a person updates this field/drop down/combo box for Access to lookup the PCArea and find out what the DCName is relevant to this and then populate the DC field in "Enquiries" and show on the form but I can't fathom how to do it.
I know it's VBA related but I can't seem to get the format right?
Private Sub Combo472_AfterUpdate()
Me.PCArea = Me.Data.Column(9)
End Sub
Sure didn't work! Any help would be great.
Replace {PCAreaDropDown} with name of your dropdown box, and all you really need is the one field in there. It looks like you threw at least 10 columns (9+1) based on your example.
me!DC = dlookup("DCName","PC", "PCArea = '" & me!PcAreaDropDown & "'"
It is basically the same question I had in this thread:
Adding values to a Report when there is no Data in query SSRS
The only difference now is that I want to extend the same functionality to different Datasets.
Imagine this:
I have two Datasets. Dataset1, Dataset2.
Both have the same primary key, in this case:
Sales Rep
Category
Now in Dataset1 I have the following Data:
The idea in that thread was to put "0" Each time a Sales Representative Did not have all the categories, if you see for example Sales Rep on DataSet1, does not have G1,G2 Category so In those cases they have to put 0.
Thanks by the answer of the community this can be achieved by adding a Calculated Field on DataSet1:
=Fields!SalesRep.Value & "-" & Fields!Category.Value
So that will give you for example 11-G1 for the 1st Row. and the expression for each Row (For each category) will be:
=iif(IsNothing(lookup(Fields!SalesRep.Value & "-" & ReportItems!Textbox62.Value,
Fields!Another.Value,Fields!Sales.Value,"DataSet7")),0,
lookup(Fields!SalesRep.Value & "-" & ReportItems!Textbox62.Value,
Fields!Another.Value,Fields!Sales.Value,"DataSet7"))
As you can see, the ReportItems!Textbox62.Value saves the value of the Category so If 11-G1 is nothing (dont exist) put "0".
The idea here is to do the same thing with DataSet2.
The tricky part is that we have to ask if 11-G1 equals 14-G1 because in DataSet2 the SalesRep does not exist for all the categories it must put "0". Both are grouped as SalesRep.
I have a payslip main report with 3 subreports, all are linked through the employee's serialNumber:
rptPayslipPay -for displaying regular pay
rptPSDeds - for displaying deductions
rptPayslipOpay - for displaying supplementary payments. This
subreport is only showed for few selected employees.
I was able to show the total amounts of the 3 subreports on my main report's page footer. Since my last subreport rptPayslipOpay, may or may not have any data, I am displaying it in a text box named [txtOpay] like this:
=IIf([rptPayslipOPay].[Report].[HasData],[rptPayslipOPay].[Report]![sumOpay],"")
My problem is,the value of [txtOpay] shows even if the page has moved on to another employee, thus displaying the previous employee's supplementary payments to the next employee.
Is there a way to prevent this from happening?
Thank you very much.
You might be able to get it to work by fiddling around with the subreports, but assuming a 1:1 relationship between top-level report and subreport, and assuming serialNumber is a string; instead of your IIf statement, you might consider trying something along the lines of:
=DLookup("sumOpay", [rptPayslipOPay].Report.RecordSource, "serialNumber='" & [serialNumber] & "'")
I'm not sure exactly how your objects are named, but I think this should be close to what you're looking for.
By your description, it sounds like "sumOpay" might be a calculated field in the rptPayslipOPay report. If so, you can use:
=DSum("<field containing data to sum>", [rptPayslipOPay].Report.RecordSource, "serialNumber='" & [serialNumber] & "'")
Granted, these will run more slowly, but this might be an easier way to get it to work.
Another option is to left-join rptPayslipOPay's data from in your top-level query, and sum it.
Is it possible to show data from database in SSRS footer?
I tried but the only option present is to show first record from dataset. But I want to show all records (I just need to show one column) one by one on each page.
Is it possible?
Based on your comment I believe this link Display on Page Footer is what you are looking for.
I tried this and it works on Page Footer.
One way to do this is by making your report a list of subreports.
Make a new report with a List item and a dataset that gets a set of all the departments you are going to get. Consider this to be your "List" report.
Populate the list with the dataset. Put a page break between List item members.
Make another report (or modify your existing one so) that is designed to be a single-page report about a single department, so #department will be one of the parameters. It contains all the data you want on each page of your report, including the footer with the Department name, which it gets from the department parameter, so it doesn't need to get it from a dataset. Consider this your "Base" report.
Going back to your List report, put a sub-report in your List item, point the sub-report to your Base report, and populate the department parameter with the value from the dataset that is populating the List.
Yes, it is possible using the "Lookup" aggregate function.
Assume, your report has a dataset named "Department_DataSet" which contains all the department's data plus one additional column e.g. PageNum, that contains an integer sequence starting from 1, giving you, basically, a sequence of the report page numbers:
PageNum | DepartmentName | Address | etc.
--------+------------------+------------+-----
1 | Department 1 | ... | ...
2 | Department 2 | ... | ...
...
N | Department N | ... | ...
Now, add a Textbox into the footer and assign the following expression to it:
=Lookup(Globals!PageNumber, Fields!PageNum.Value, Fields!DepartmentName.Value, "Department_DataSet")
and it will show the department name as required, but please ensure that the page numbers go in the same order as the departments in your detail report.