My Query is like below for Table...,
Create Table t_raw
(
Month nvarchar(255),
Name nvarchar(255),
Clear nvarchar(255),
Contact nvarchar(255),
Viewed nvarchar(255),
Clicks float
)
Insert Into t_raw values('Jan-18','ABC','DTC','dtc#mz.com','GM','2'),
('Feb-18','QSC','FMM','fmm#mp.com','AM','6'),
('Mar-18','ABC','DTC','lta#mz.com','OPS','9'),
('Jan-18','MHY','GNMA','gnma#sr.com','REP','3'),
('Feb-18','VRL','XLR','xlr#vn.com','TUC','5'),
('Mar-18','MHY','GNMA','gnma#sr.com','XEM','7'),
('Jan-18','ABC','DTC','mat#sd.com','SUD','2'),
('Feb-18','MHY','GNMA','mio#fr.com','AFT','4'),
('Mar-18','TOC','ADF','fin#yu.com','BPL','2')
Below is the table:
I am expecting the below output like below.
Can anybody help me achieve this desired output?
Create a blank report and create a Data Source and a Dataset to connect to the data. Add a Matrix to the report. Drag the Name fiield from the Dataset in the "Report Data" window to the first "Rows" field of the matrix and select the Month field using the field selector in the Columns header field. Select the Clicks field in the data cell under the Month header, this should automatically result in a Sum. In the properties window of the Month Column Group change the sort order to an expression like
=CDate(Fields!Month.Value)
Change the width of the Name field to be wide enough to contain the four columns Name, Clear, Contact and Viewed (I chose 12 cm).
Now, right-click the Name header cell and insert a table via context menu. Don't worry about the hights and add an additional column in that table.
Do the same in the Name data cell
The design should now look like this:
In the table next to the Month field (I'll refer to that as "header table"), remove the Data row (and associated groups, when asked):
Then in the table next to the Sum(Clicks) field (I'll refer to that as "data table"), remove in turn the header row:
These steps resolve the problem with the hights.
In the "header table", enter the column names and format them as desired. In the "data table", select the corresponding fields to display. In the properties of the Row Group "Details1" of the "data table". add all 4 fields in the correct order for grouping and sorting.
For the fist 3 fields in the "data table", use the Properties sheet to set the HideDuplicates property to the name of your Dataset.
For the Sum(Clicks) TextBox, set TextAlign to "Center" and VerticalAlign to "Middle".
Oh, and add a total for the Name group of the outer matrix, align everything as desired.
VoilĂ :
Added:
To merge the cells for Name, Clear and Contact do the following:
In the properties of row group "Details1" of the "data table", remove Name, Clear and Contact under Grouping and under Sorting properties, so only Viewed is left. Rename the group to Viewed.
Remove the first three columns of the "data table" (Name, Clear and Contact).
Right-clicking always the topmost row group of the "data table", successivly add parent groups for Contact, Clear and Name.
Related
I am using MS Access 2010 to create an inventory database, and I have a form for users to enter purchase/inventory data, which looks like this:
The data underlying this form is actually stored in four separate tables - [Food items], [Invoices], [Inventory], [Food purchase data]:
I am trying to figure out how to make it so that the "invoice ID" dropdown in the form presents the user with a list of all of the invoice IDs that are currently present in the [Invoices] table. But once they select an option from that list, I want the dropdown to set the Invoice ID field in the [Food purchase data] table to that number. Basically, I'm just trying to make sure that when orderers are entering data in the [Food purchase data] field they are only able to enter/select values that are valid Invoice IDs.
What is the simplest way to do this?
You can do this by adding some code to the After Update event of the invoice combo box.
You should set the bound column of the Invoice combo box to be the InvoiceID. You'll need the ID of the FoodPurchase record you want to set too.
Dim sql as string
If Nz(<InvoiceCombo.Value>,0) <> 0 Then
sql = "UPDATE <FoodPurchaseTable> SET <InvoiceID> = " & <InvoiceCombo.Value> & " "
sql = sql & "WHERE <FoodPurchaseID> = " & <FoodPurchaseRecordID> & " ;"
CurrentDB.Execute sql
End If
Change the items in the <>'s to match your controls and tables. The is the name of the field in the table and is the index of the record you're trying to set.
I'm trying to create a combo box that has the only the field names from
a table in it and not the items in that field. So for example I have a
table with 40 fields in it like Account#, Name, address, phone # etc...
I want to click on the combo box and have the option to choose a field
and not the data within the specific field. So when I click the drop
down it will show all the fields in the table (Account#, Name, address,
phone..) I've tried a few different idea's from people but cant get
it to work. I'm using Access 2002 if that helps.
An Access combobox has a option for Row Source Type of 'field list'.
Just set the Row Source Type to 'Field List' and select the table from the Row Source dropdown.
you can use the sp_columns stored procedure for sql server to get a list of column names for a given table
I'm using SSRS for my reporting, my reporting solution is in Visual Studio 2008 Business Intelligence Development Studio.
I have a report in which the data should be displayed in this format.
I have added a Column Group in my table which is having the values of Customer Name and details, the data is coming fine in the vertical format i.e column after column.
My Issue :
There should be only three columns in each row, after three records the next row should begin and again not more than three records should be displayed as shown in the image above.
My attempts :
I tried to add a row group and in that gave the expression
= Ceiling(Fields!Row_Count.Value/3)
here Row_Count is a field which is coming from my query which holds the serial number of the records.
My SQl Query
SELECT Row_Number() over(order by table_ID) AS Row_Count, Field_1,Field_2 from MyTable
In my Column group i have Customer Name and in my Row Group i have other details of the customer. The data is getting populated column wise but the issue is its not breaking the current row after three records.
Below is my table of report.
You were on the right track. Say you have data like this:
I have created a tablix like this:
The Row Group expression is:
=Ceiling(Fields!Row_Count.Value / 3)
This works together with the Column Group expression to split over three columns:
=(Fields!Row_Count.Value - 1) Mod 3
The other thing to note compared to your tablix is that CustomerName is not in a table header row, but rather there are two row header rows, one for CustomerName and one for Details.
This is looking OK to me, obviously you can format to taste:
I have a datagrid, which contains two columns.. second column will contain a dropdown .. The dropdown contains all the DB column names and when i select any DB column field from the dropdown then the field will be mapped to first column and the selected field from the dropdown will no longer exists in the dropdown.
when i clear the field from the first column, then the field will again bind to the dropdown, but the field is displaying at the last in the dropdown, so the field should not be displayed at last, it should display in it's previous place(i.e from the place where the field mapped from dropdown).
So can any one please let me know how to handle this is xaml.cs file.. That will be more helpfull for me...Thanks !!!
Initially i have declared an ObservableCollection OcCols = null;
//Used TableColumnsQuery in swith case case and adding all the column names from the table and then added the columns to OcCols.
TableColumnsQuery is declared as "SELECT COLUMN_NAME FROM information_schema.columns WHERE COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity')!= 1 and table_name ="
case "TableColumnsQuery", in the case adding all the columns from the table to OcCols and then adding the OcCols to the grid.
((GridViewComboBoxColumn)this.gridMappings.Columns[2]).ItemsSource = OcCols
Gridmappings is the grid name and second column has the combo box\dropdown which i have xplained earlier.
so now how to sort the columnfileds in the combobox/dropdown.
Thanks!!!
I have a Access DB and 2 tables
I need to set the relationships but need some help.
table 1
id
name
address
postcode
room-name
table 2
room-names
Then table 2 contains data:
eg:
kitchen, bedroom etc
How do I do this join so that table1 room-name field contains table 2 room-names list?
The best way to do this is to create a field in table one called "room_name_id" and set it as a Number. It will take up less space in the mdb file over time. (Sidenote: You can't use "name" as a field name since "name" is a reserved word in Access.)
Next create table two so you have an "id" field and a "room_name" field. So if "Spare room" contains id 1 then in table one, room_name_id could be 1.
Here's the SQL that you could use on a query.
SELECT tblInfo.username, tblInfo.address, tblRoomNames.room_name
FROM tblRoomNames INNER JOIN tblInfo ON tblRoomNames.id = tblInfo.room_name_id;
This will show something like "Peter", "Narnia", "Spare room" even though table one has "Peter", "Narnia", "1".
P.S. I use this all the time at work to populate dropdown boxes with options for the user to choose from. This way I can update multiple dropdown boxes just by editing one table.