RDLC showing additional Rows in a table - c#

I am creating a Report on RDLC. Lets say i have 2 tables in database where im importing data from users and expenses.
Each user can have multiple Expenses. Expenses contain Details and amount just 2 columns that i have to include in the report.
Ive created a stored procedure but its duplicating rows because of having same UserId in expenses. So far im able to achieve this.
See This Picture
What i wanted is that One row with column bulty id and other details with multiple sub rows of expenses.
How can i achieve this. I've tried hide duplicate property in RDLC but its showing duplicate column fields
This is what i wanted to achieve
See image

in this case, I use matrix tool in RDL file.
you should set expenses the ColumnGroup of the matrix

Solved it by doing the Master/Detail Approach. Put 2 tablix in the list. on the first tablix set user details and made a row group so that the values dont repeat and then on the second tablix used the additional data fields.
Then dragged this additional data tablix into the row of first tablix and everything seems to work just fine.
For serial numbering i used Counting distinct values according to my userid

Related

How to load two RDLC reports in same report viewer?

I have two reports the first one to show general information and the second one to show details and I need to show each one in a different page in report viewer
can you help me to do that
thanks
like the image
Hopefully, the following can help guide you into what you are looking for. First, you will need THREE reports and TWO datatables (or other lists as you have to build your report).
First, On the 3 reports I describe, I would not worry about any of the report final formatting to be perfectly aligned, bold, spacing... get it to work, then you can make it pretty after all is functional.
Next, create a bogus datatable "MyTable" for the sole purpose of creating two records. Even if a single column of "MyGroup" and having it as an int (just for sample purposes).
Now, create two records and set the values in each row to 1 and 2 respectively so your table has
MyGroup
1
2
Now, for the other two reports. It is my understanding that you want the first report to show a summary of each department's totals with a grand-total. The second report is showing the details of all the activity per department. So this is basically using the same dataset returned from whatever query. For this example, I will refer to the datatable as "SalesData".
CREATING THE REPORTS
Create your first report, put a table control on the report, full width you will have for your current reports as landscape or portrait as long as both the same size, you want this report to be the same. Ex: ALL will be portrait. Add your Report Data source to show the "MyTable" and assign that to the table control. Also add the "SalesData" table to the report as well so it is available to the future sub-reports.
On the table control, below where it shows the "Row Groups", add a "Group By" for the "MyGroup" column. This is so we can force a page-break between each group. Once added, right-click on the parent group "MyGroup" and select "Group Properties". This will show an option on the left side to allow you to set page breaks, click the checkbox for "Between each instance of a group". For now, just have the one column in the table control as the "MyGroup" column. Save the report ex: "MySalesRpt.rdlc". Then compile and run the report. You should get this simple report with 2 pages, each showing just the number 1 and 2 respectively. NOTE: You will also want to add the datatable reference for your secondary reports to this main report as well so they are available as sub-reports of the first.
Create a new report ex: "MySalesDetail.rdlc", add the "SalesData" to it. Add a table control to the report and set its source to the "SalesData" table. Include whatever for your detail columns you want to show of the sales activity. Add a data group based on the department, get your sum( salesDollarColumn ). Add a new row outside/below the group footer so you can have the report grand totals as a sum of all ex: SalesDollarColumn. You can test and run this report on its own until it looks correct.
Now, your third report. Copy/paste the MySalesDetail.rdlc report and change it to MySalesSummary.rdlc. So you don't this summary report showing every row that builds the grand total sum() per each department, right-click on the row that represents the details of the group and delete. It will ask if you want to delete rows and associated groups? Reply yes as it will just remove the details row, but keep the group footer that will retain your sum() total per department. Save, test / run this report.
Once all 3 reports work individually, now we can go back to the "MySalesRpt". Add an additional DETAIL row in this otherwise simple 1-detail report. Right-click on the existing detail row and then pick "Insert Row" -> "Inside Group - Below". This will now show as two rows.
Now, in the first row of the report where it did have just a simple textbox, go to your report Toolbox and pick Subreport and put one instance into each row.
On the first row, subreport, right-click and set properties. Set both the Name and "Use this report as a subreport" to the summary report "MySalesSummary". On the second row subreport, do the same but with "MySalesDetail".
Final step. Click on the Subreport representing the "MySalesSummary". Go to the properties of that and scroll down to the "Hidden" property. You want to have this value set to the expression: ex: "=Fields!MyGroup.Value = 2". This way the report will ONLY be generate when it is on the first record where MyGroup = 1.
Similarly, on the second subreport representing the detail, set the hidden equal to the opposite.. "=Fields!MyGroup.Value = 1". Hide when the MyGroup = 1. This way you can have each report on their own page, but only one will show up per group.
I know is sounds deep, but do it slowly and it should work for you. I already did and confirmed this process works. Sorry so many steps, but it has to be broken into multiple parts to tie them all together as you are requesting.
One rdlc in main local report and the other in subreport. Then set InteractiveSize in the main local report to break it to show each one in a different page in report viewer.

Display each record in different pages on a textbox in rdlc report

I want to display data-set record in different pages . i am using rdlc reporting in c# win form.
in rdlc design i am using text-box which show only single data.
i want to display all data but in separate separate pages.
actually i am printing multiple cards in bulk , it should be in different pages so i am unable to do.
kindly help me.
I already try page-break in rdlc report but its not working
this.sp_bulkprintTableAdapter.Fill(this.db_ShopDataSet10.sp_bulkprint, date1, date2, Convert.ToInt32(catname));
See the image here to understand what i want. i want to print this type of cards in bulk from database using simple select query. what i am facing problem is textbox is not showing multiple records and each record on different page.
i have done with it by performing following steps
1) add table in rdlc report
2) remove header row and two default columns remaining single row and single column.
3)enlarge the table
4)remove the default textbox in table
5)add rectangle --- add page break here
6) add textboxes. (multiple).
Now each row of my data is printing on different page.
Make sure that your page size is correct.
I found that I could just drop a List (Toolbox: Report Items -> List) component on the page. Stretch it to fill the area you desire and drag fields into appropriate locations. Works great for making individual labels for each data row.
Net 6 mvc web project using Microsoft.Reporting.NETCore.

Split rows by name

My stored procedure gets info from SQL DB. Now I want to add the info to a crystal report and display the PDF with all the details.
I use Visual Studio with Crystal reports installed, coding in C# using Dataset to get my info from SQL. The info is a list of names with 3 other details that goes with those names (columns). At times it can be one name as a result, or it can be 3 names as a result.
My aim is to have a table on the report, and each table row lists a name in the first column, then in the 3 consecutive columns its corresponding details. Same look to the SQL table you get when pulling the info.
To setup the individual columns is easy, drag each field onto the report. But how can I split the names so that I have one name listed per table row? This is the result from query:
I want to populate it into my Crystal form which looks like this:
The solution that I have ended up with was to create a sub report, place it on top of the table I have created in my second picture. Then added the columns to the sub-report, took away any borders. And then between the container size on the report and with the paragraph options of the container I adjusted the line spaces. Now if I have more than one row in the list, it appears on each line as needed.

Create Template Field for n number of columns in Database at RunTime

I need to develop a Web Tool which shows Grid View containing Data of a Table which is generated at run time.
I want to create Filter functionality with Drop Down List on all the columns of GridView except 1 at run time.
For Now only Header Template is getting populated with Distinct Rows in Drop DownList but Complete Column Down is Empty. and GridView is getting Populated with same Columns again in the end of last Column.
Any help would be highly appreciated.

displaying and updating data of two tables from a grid (or table) in aspx page?

I need your guidance please for doing a unusual task which I am not getting how can be done. I have three database tables. CompanyName (it have Id and CompanyName columns) and Agent (it has id and AgentName columns) and Rates (RowId,AgentCompanyName,AgentName and Date).
Requirment is to display data of Agent and Companies tables in one grid or table in a way that Companies will appear as columns and agents will appear as rows on top x-axis and agents will appear as rows (in one column) on y-exis. This is display just like a matrix and conjunction of each will have a textbox to get (agent's value for that company).
NOTE: update buttons can be on left side as a column or under table as a single button. There can be any no columns (compnayName) and any no of rows (agent names). On pressing Update these rates will be saved in Rates table.
How can I display such a page and how implement Update functionality?
Depending on what works best for you, you could create one stored procedure that accepts all of those fields and updates the tables, or you can execute an insert/update stored procedure for each table.

Categories