SSRS Current Document Map Display - reporting-services

I have a report that has document map on two columns...
I am trying to display the currently selected data (CAF SA -> PP5566) on its own page (using page breaks between groups) with the report name and code above the table of data, an example show below with the arrows:
So if I click the next code it will change data accordingly:

Here is how I would probably do it based on what I know.
The following example uses the Microsoft supplied Northwind sample database in case you want to reproduce this.
First I created a dataset pointing to the Northwind database using the query
SELECT DISTINCT
r.RegionID, r.RegionDescription
, t.TerritoryID, t.TerritoryDescription
, e.EmployeeID, e.FirstName, e.LastName
, c.CustomerID, c.CompanyName
FROM Region r
join Territories t on r.RegionID = t.RegionID
join EmployeeTerritories et on t.TerritoryID = et.TerritoryID
join Employees e on et.EmployeeID = e.EmployeeID
join Orders o on e.EmployeeID = o.EmployeeID
join Customers c on o.CustomerID = c.CustomerID
This will give us Region (the top group level), Territory (second group level) and some employee names and customer names which we can use in the detail part.
Next, added a tablix (table) and dragged the first name, last name & company name onto it. This will be the details row.
Next I right-clicked the details group in the row group panel and chose 'Add Group => Parent Group', set the group by to 'TerritoryDescription' and checked the 'Add group header' option before clicking OK.
Next I right clicked on the new TerritoryDescription group and repeated the above, this time using 'RegionDescription'
On territory row I added some static text into the 3rd column (under FirstName) and the territory description field as the expression for the 4th column (under last name). Now right-click on Territory static text you just added and choose "Insert Row => Inside group Above". Add static "Region" text and region field into column 3 and 4 respectively
I added a page header and footer just to it looks clearer when viewing on screen.
Next delete the first two columns as we no longer need these, select 'delete column only' if prompted.
Now double-click the TerritoryDescrition group in the row groups panel, click 'Advanced' and set the document map to 'TerritoryDescription'.
Repeat this for the RegionDescription row group selecting 'RegionDescription' this time for the document map.
The final design looked like this...
I set the report 'InteractiveSize' height to 15cm for clarity.
When the report is run I get this..
If I drill down to a differnt Region and Territory, I get this..

Related

Lookup using textbox value as source showing too many rows + SSRS

I did a lookup function in ssrs where the source is a reportItem reference. I want to return the value from the table that I am looking up based on the reportItem reference. The report is retrieving the correct values, but and I'm getting repeated rows and I'd like to know if there's a way to eliminate that. My parameters in the tablix is based on a ticket number.
The underlying data has 3 transactions but 9 rows are currently being returned.
In SSRS, my query is:
Select
ticketno, name, control, value
from ticket a
inner join details b on a.ticketno = b.ticketno
where control like 'LS%' and ticket = 'ED08'
The return result contains 4 rows transactions
ie:
Ticket
Name
Control
Value
ED08
Eng
LS1
A
ED08
Acct
LS2
B
ED08
Med
LS3
C
In SSRS, I used a table and hard coded the Name as it's possible that there will be no values.
I hard coded Eng, Acct, Med, Dent for names.
I entered an expression on each individual row with an expression
=lookup(ReportItems!textbox.Value,Fields!Name.Value,Fields!Value.Value, "UDF_Det")
However, when I run the report, I get extra rows.
The transactions retrieved from the ticket in SQL only retrieved 3 rows, so I would have expected that. Is there a way to filter on row specific data?
I have looked at this post Adding values to a Report when there is no Data in query SSRS but since I am not doing any calculations I'm not sure why I am getting repeat rows.
My design looks like this:
Output looks like this:
Acually, now I've edited your question I understand the problem. :)
You can just get a list of Name and left join from it to your existing query.
You maybe able to get the list from an existing table (hopefully) or you could hardcode one (avoid if possible).
Assuming all the Names you need are in your ticket table you could use something like this...
SELECT DISTINCT [Name] FROM ticket
(if name comes from another table, just change the query to suit)
then left join your existing query to this, something like
SELECT n.[Name], t.ticketno, t.control, t.value
FROM (SELECT DISTINCT [Name] FROM ticket) n
LEFT JOIN (
Select ticketno, name, control, value
from ticket a
inner join details b on a.ticketno = b.ticketno
where control like 'LS%' and ticket = 'ED08'
) t
ON n.[Name] = t.[Name]
which should give you something like
Name
Ticket
Control
Value
Eng
ED08
LS1
A
Acct
ED08
LS2
B
Med
ED08
LS3
C
Dent
NULL
NULL
NULL
Then you can simply have one row in the detail group in your table to output the results.
If this does not help, post some sample data from your database tables and show the full report design including row groups etc

How to keep two dataset(grouping on each dataset) on one page

I have a requirement on which i need to show calender for each month with days on it and below this i need to show count for different services for that particular month. For this i have created two datasets
1> For the calender one
2> Different services for each month. Now I am not sure how to keep these two data sets on one page means
suppose its january month, so i need to show the calender for the January month and the total sevices for january month on one page and in the second page it will be show these two for februray month and it will go on. The number of months is controlled by a parameter .
What i have done now ?
For the 1st dataset the group is there and i have put page break after the group. And for the 2nd dataset, i have the group and put a page break after the group.
Please suggest how can i put these datasets on one page ( both are having group on the basis of month).
Thanks in advance.
Regards
Subrat
Here's a quick example.
NOTE: I'm using the AdventureWorks sample database here..
First we create the subreport. This will be a standard report but it will only produce results for a single month in our case. In this example I only pass in the month number as a parameter but obviously you might need to change that to pass in a year and/or other information.
I created a new report called Month Sub Report
I created two datasets that will give me sales by person and sales by territory for the same month. The queries I used are as follows.
-- query for dsSalesByPerson
select MONTH(OrderDate) as MonthNumber, SalesPersonID, p.LoginID , SUM(TotalDue) as Amount
from Sales.SalesOrderHeader s
join HumanResources.Employee p on s.SalesPersonID = p.BusinessEntityID
where datepart(yy, OrderDate) = 2013
and MONTH(OrderDate) = #MonthNumber
GROUP BY MONTH(OrderDate), SalesPersonID, p.LoginID
-- query for dsSalesByTerritory
select MONTH(OrderDate) as MonthNumber, t.Name as Terrotory , SUM(TotalDue) as Amount
from Sales.SalesOrderHeader s
join sales.Customer c on s.CustomerID = c.CustomerID
join sales.SalesTerritory t on c.TerritoryID = t.TerritoryID
where datepart(yy, OrderDate) = 2013
and MONTH(OrderDate) = #MonthNumber
GROUP BY MONTH(OrderDate), t.name
Note These both use the same parameter name with the EXACT same spelling, including case. As the create the datasets the parameter will be automatically created. If the name is the same on both databasets, only 1 parameter will be created which is what we want.
Next I added two simple tables and a textbox that looks like a header (actual headers don't work in subreports)
The final design looked like this.
When I run the subreport I get something like this.
Save and close this report design....
Next, create a new report, in this example I called it Month Master Report.
I created dataset called dsMonths with a list of months in (MonthNumber and MonthName) that we will use in our main report parameter to allow users to chose the months they want to report on.
I set the available values to point to our dsMonths dataset query and set it to allow multiple values (leave type as text)
Next create another dataset called dsMain. The query for this dataset needs to return a unique list of monthnumbers from your database so it might look something like
select DISTINCT MONTH(OrderDate) as MonthNumber
from Sales.SalesOrderHeader s
where datepart(yy, OrderDate) = 2013
and MONTH(OrderDate) IN (#Months)
ORDER BY MONTH(OrderDate)
Note: We use IN here as we are passing a list of #Months in.
Next, insert a table
Set the Dataset property og the table to dsMain
Next, remove the header row and all the column except 1.
Your table should have just a single 'cell' remaining. In this cell, right-click and insert a subreport.
Right-click the sub-report placeholder and choose properties.
Set the subreport used to be your subreport created earlier (i.e. Month Sub Report)
Click the parameters tab and then click "Add". Choose "MonthNumber" from under the name dropdown and your monthnumber fields from the value drop down list.
Next, double-click the "(Details)" row group nuder the main design window, click "Page Breaks" and select "Between each instance"
FINALLY! Mover the table to the top left corner of the page and shirk the report body so there is not lots of space around it (or this can cause unexpected page breaks)
When we run the report and choose a few Months we get the following, with each selected month on a new page (I'm only showing the last page in this image)
Hopefully that will give you enough to solve your issue.

RDL a group for both row & group column

i have an RDL contains 1 row group and 1 column group
I want to create one more group which wrap both this 2 group
So that group X will be created, and records of row group A & column group A will generate base on group X.
but i found no solution to add that group X.
Is there any solution to do it? or it is impossible in RDL?
Above is the expected result with some important points
A is row group,
C is column group, the string C, C1 ,C2,C3 are actually the data from the same dataset with A, just the grouping parameter is not the same
DATASET
Below are the interesting requirement:
for each group of A (lets say A1&A2), it will display in a new page (ie. new tabs in the SSRS)
there is total row for each row group member
As mentioned C - C3 are generated dynamically based on the dataset. There are total for each group of A and requires to aggregate the sum for both rows,
thus C somehow need to cater the filtered dataset of A, and display the sum
The problem is:
In the page of A1, C1 & C2 will be blanked. C & C3 contains value
In page A2, C & C3 will be blanked and C1&C2 can be displayed
In fact, for the blank column ( for example A1), even the string C1 & C2 also unable to display as A1 didn't contain the data of C1 & C2 at all
I think what you want is not an additional group, but you want to nest your tablix inside of a list object. There's not any way to add both a column group and a row group inside of a universal grouping unless you use another control item. Then, you can add the grouping on the list item and it will do what you need. In the image below, you can see that my tablix is inside of a single row of a list object and the list object is grouped by a master ID for this report. This allows the inner row and column groups to expand as necessary, but separates them based on the master ID. I also put page breaks on this list item to put each ID on a new page.

MS Access Form: How to show all records that reference current record

I have a form showing Customers. Now I would like to also display all Orders that the currently open customer has made.
The Order table has a foreign key to Customer.
I have tried using a list box with Multi Select set to Simple, but somehow it shows me all Orders instead of just the ones of the current customer.
More Details:
My list box has
Control Source: ID
Row Source: SELECT customer.id, order.info FROM customer
INNER JOIN order ON customer.ID = order.customer_id
If I set the Multi Select to None it always marks the first Order that matches the current customer, but not all matching orders.
Can someone point me in the right direction?
Thank you.
P.S. I don't necessarily want the list to be functional for the creation of a new Customer. If it would also work then that's a bonus.
Assuming your form is bound to Customers table, then you need to add code to the form's Current event:
lstOrders.RowSource = "SELECT id, info FROM order WHERE customer_id = " & Me.id
lstOrders.Requery
The list box (called lstOrders) should have its column count set to 2. If you don't want to see the order.id column then set the "Column widths" property to 0 (this will set the width of the first column to 0 and let the second column, order.info, fill the remaining width of the list). Set the "Bound column" to 1 - this means that the "value" of the list box will be the order.id

MSACCESS. Forms- Dropdown to update foreign key

Tables
Company- CompanyID, CountryID , Company Name,
Country-CountryID, Country Name
I am creating a form to edit the company information. I am having problems updating Company's CountryID. I want a dropdown to displays every country which will modify the company's foreign key.
I followed the tutorial here. http://www.techonthenet.com/access/comboboxes/bind_index.php. It works with inner but it doesn't display all the countries. But when I switched SQL inner to left join, the form fails.
My sql-
SELECT DISTINCT table_country.Country, table_company.Country_id
FROM table_country LEFT JOIN table_company ON table_country.Country_id = table_company.Country_id
ORDER BY table_country.Country;
![enter image description here][2]
The the RowSource property of the combobox should only contain a lookup list. It should not be retrieving records from the company table.
The RowSource property should be:
SELECT Country_ID, Country FROM table_country ORDER BY Country
Set Column Count to 2
Set Bound Column to 1
Set Column Width to 0 as you don't want to display the country_id only country.