How to create a report with sections and page breaks using SSRS - ssrs-2008

I'm trying to create a report that looks like this:
using a select from this table: (fiddler here for query and data)
CREATE TABLE StudentData
(
id int PRIMARY KEY IDENTITY,
name varchar(30),
subject varchar(30),
currentGrade varchar(2),
targetGrade varchar(2),
note1 varchar(100),
note2 varchar(100),
note3 varchar(100),
UNIQUE (id)
)
Basically I want to display each student on a new page, with their subject split up into sections, and their grades and notes in each of these subject sections.
I am trying to do this within Business Intelligence Development Studio
Any help with how I would go about that would be great, thanks.

I can upload the images now.
First you add a List Tablix to the report with the name and add a TextBox
Add a Parent Group to the list in the Row Group category
Choose name as the Group By Column
You will have two columns, one with the group and another with the TextBox created previously
Add more TextBox with the rest of the columns missing.
Now we're going to set the break on each group, select on the Row Groups section the group name and right click and select Group Properties
Select the Page Break page and then check the option Between each instance of a group
You should have something like this now.
Now let's configure the name to appear to the top of each page, select in the Row Groups section the Details Group and add a Total Before
And after add some TextBox and some colors you will have something like this.
I hope this can help you.

Add a List and set the DataSetName to your existing Dataset. In the Row Groups definition for the list, tell it to Group on id. Add a textbox for the name.
Add another List inside the existing List and set the DataSetName to your existing Dataset. In the Row Groups definition for the list, tell it to Group on subject. Add a textbox for the subject.
Add 2 Tables inside the inner List to present your inner-most tables.

Related

RLS on table who can view rows respective person

I have requirement like this, specific country rows can access by only respective owner remaining rows need to be hide in oracle(sql developer) Can any one help me
Create table Locations (I'd int, category varchar2(20, country varchar2(20), owner varchar2(20));

Is it possible to create multi scheme view in RedShift and how?

I have multipale schemes in Redshift that are similar to one another
basically for every new customer a new scheme is created.
in each scheme i have products table: product_id , product_name
and i have one view that present the scheme_name and scheme_id.
I need to create a single view that will show all the product_id and product_name with the scheme_id next to it.
so in the end i will have one view with all products from all schemes and the scheme id so i will know to which one it belongs.
how can i create a dynamic view for it?
Within a database you specify a schema then a "." then the table.
e.g.
create view views.demo
as
select *
from schema1.table1 as a
join schema2.table2 as b on a.id=b.table1_id
you can create this dynamically OUTSIDE of redshift using python or similar

Dynamic parameter in Crystal Reports with filter

There is a possibility in Crystal Reports to use dynamic parameters - list of choices for parameter isn't fixed and typed in the report but is taken from some database table. It is described for example here:
https://www.youtube.com/watch?v=kuHs89yyuEc
My problem is that a parameter created in such way allows to choose from ALL values in the table.
I'd like to filter it in relevance with data in report.
For example: My report represents an invoice. It is filtered to a single invoice by invoice id. A parameter allows to select place of delivery for the invoice. But I don't want to choose from all places of delivery in the table. Instead I'd like the parameter to display only places of delivery for the customer from the invoice.
Let's say customer_id is a formula field in a report and place of delivery is a table like
id customer_id street city ...
Is it possible to filter the dynamic parameter in the way I describe?
EDIT:
Maybe a simple example helps.
I've created a test database with two tables (I'm using Sql Server):
CREATE DATABASE TEST
USE TEST
CREATE TABLE [dbo].[DELIVERY_PLACE](
[ID_DELIVERY] [int] NULL,
[ID_CUSTOMER] [int] NULL,
[ADDRESS] [varchar](50) NULL
) ON [PRIMARY]
INSERT [dbo].[DELIVERY_PLACE] ([ID_DELIVERY], [ID_CUSTOMER], [ADDRESS]) VALUES (1, 1, N'Address A1')
INSERT [dbo].[DELIVERY_PLACE] ([ID_DELIVERY], [ID_CUSTOMER], [ADDRESS]) VALUES (2, 1, N'Address A2')
INSERT [dbo].[DELIVERY_PLACE] ([ID_DELIVERY], [ID_CUSTOMER], [ADDRESS]) VALUES (3, 2, N'Address B1')
INSERT [dbo].[DELIVERY_PLACE] ([ID_DELIVERY], [ID_CUSTOMER], [ADDRESS]) VALUES (4, 2, N'Address B2')
CREATE TABLE [dbo].[CUSTOMER](
[ID_CUSTOMER] [int] NULL,
[NAME] [varchar](20) NULL
) ON [PRIMARY]
INSERT [dbo].[CUSTOMER] ([ID_CUSTOMER], [NAME]) VALUES (1, N'Customer A')
INSERT [dbo].[CUSTOMER] ([ID_CUSTOMER], [NAME]) VALUES (2, N'Customer B')
And I have made a report using this database. you can get it here:
https://www.sendspace.com/file/907wq9
The report filters to CUSTOMER_ID=1
DELIVERY_PLACE table links in report to CUSTOMER table by foreign key: CUSTOMER_ID
I have a dynamic parameter that takes address from DELIVERY_TABLE
But it shows all addresses while I want it to show only addresses filtered to current customer
I should've posted this as comment, but i dont have points etc.
As per my understanding you need to connect the tables on CustomerID. This will automatically link the customer to its address. Secondly you do not need parameter to select the right customer's address, you should place the database field Address from DELIVERY_PLACE, instead. I dont have your database so am lacking knowledge if both tables are already linked. Please right click the databasefileds node and show sql query.. and then post it for better understanding.
You can also change your RecordSelection formula to {CUSTOMER.ID_CUSTOMER}=1 and {DELIVERY_PLACE.ID_CUSTOMER} = 1
This will show two addresses for each customer as per entries in the tables. if you want to select single address from the addresses table during runtime. you need to put it in record selection formula say ..
{DELIVERY_PLACE.ID_DELIVERY} = {?DeliveryPlace}
moreover it is better to give ID_DELIVERY to the parameter instead of complete address.

Multi dataset drop down list in SSRS

Is it possible to create one drop down list for more than one dataset and query according to the selected parameter from the drop down list.
For e.g.
If I have a two datasets,
Dataset_1 values:
Person_ID
Name
Address
Dataset_2 values:
Product_ID
ProductName
Price
Now what I am trying to do is add both dataset's ID to drop down list. When I choose Person_ID, report should show only dataset_1's value and vice versa.

How do I create a report with multiple 1-M relationships?

I need to create a report that shows, for each master row, two sets of child (detail) rows. In database terms you can think of this as table 'A' having a 1:M relationship to table 'B' and also a 1:M relationship to table 'C'. So, for each row from table 'A', I want to display a list of child rows from 'B' (preferably in one section) and a list of child rows from 'C' (preferably in another section). I would also prefer to avoid the use of sub-reports, if possible. How can I best accomplish this?
Thanks.
I think I understand your question correctly, ie for a given row in Table A, you want the details section(s) to show all connected rows in Table B and then all connected rows in Table C (for any number of rows in B or C, including zero). I only know of two solutions to this, neither of which is straightforward.
The first is, as you've guessed, the disliked subreport option.
The second involves some additional work in the database; specifically, creating a view that combines the entries in Table B and Table C into one table, which can then be used in the main report as a linkable object to report on and you can group on Table A as desired. How straightforward this is will depend on how similar the structures of B and C are. If they were effectively identical, the view could contain something simple like
SELECT 'B' AS DetailType, Field1, Field2, FieldLinkedToTableA
FROM TableB
UNION ALL
SELECT 'C' AS DetailType, Field1, Field2, FieldLinkedToTableA
FROM TAbleC
However, neither option will scale well to reports with lots of results (unless your server supports indexing the view).
This is exactly what Crystal was made for :)
Make a blank .rpt and connect to your data sources as you normally would.
Go to Report->Group Expert and choose your grouping field (aka Index field).
You will now see a Group Header section in your design view. This is your "Master row". The Details sections will be your "Child rows".
In the example image below, this file is grouped by {Client}. For client "ZZZZ", there are 2 records, so there are 2 details sections while all the other clients only have 1 details section.
Edit
Based on your response, how about this:
In your datasource (or perhaps using some kind of intermediary like MS Access), start SQLing as follows.
Make a subquery left joining the primary key of TblA and the foreign key of TblB. Add a third column containing a constant, e.g. "TblB"
Make a subquery left joining the primary key of TblA and the foreign key of TblC. Add a third column containing a different constant, e.g. "TblC"
Union those 2 queries together. That'll be your "index table" of your crystal report.
In Crystal, you can have multiple grouping levels. So group first by your constant column, then by the TblA primary key, then by the foreign key.
This way, all the results from TblB will be displayed first, then TblC. And with a little work, tables B & C won't even have to have the same field definitions.
You can use or create columns that are used for grouping, then group on the table A column, then the table B column, then C. (Crystal's group is not the same as t-sql "group by". In Crystal, it's more of a sorting than a grouping.)