I am designing a report With the Format With Multiple Columns option in the crystal report to display 10 records per column.But, my result set is Showing like,
1.Row1
2.Row2
3.Row3
4.Row4
5.Row5
6.Row6
7.Row7
8.Row8
9.Row9
10.Row10
11.Row11
12.Row12
13.Row13
14.Row14
15.Row15
16.Row16
17.Row17
18.Row18
19.Row19
20.Row20
instead of
1.Row1 11.Row11
2.Row2 12.Row12
3.Row3 13.Row13
4.Row4 14.Row14
5.Row5 15.Row15
6.Row6 16.Row16
7.Row7 17.Row17
8.Row8 18.Row18
9.Row9 19.Row19
10.Row10 20.Row20
what else I had to do to split the rows and display.
Note: I had already asked this kind of Question and got the answer to use Format With Multiple Column in this Link.
to set multiple columns you have first to do to Report -> Section Expert
Then in the details section you have to check Format with multiple columns
After that you should select the layout tab and set width of your column and the gab between them.
Related
I want to break the table as soon the data encounters June. I want only one table which should split the table keeping the table header intact. I searched the whole internet but I am not getting any reliable solution I can go with.
Right now I am getting all the month in a single column, as you can see from the image left side is what I want and right side is what I am getting
I am trying to achieve this in SSRS 2012
If I understand you correctly what you want is the same table to appear displaying information for a time period from July to the following June for each year (so July2015-Jun2016, July2016-June2017…)
If you were to use a dataset in the following format (which looks similar to that posted in your image above
CashFlowYear theDate Revenue Expense
2015 12/01/2015 1000 500
2016 01/01/2016 1100 1500
(Note that the date column where you list a bunch of month names are represented by an actual date here)
You want to create a repeating table, so create a rectangle in your report. Then create your tablix within this rectangle. It should look something like this.
Then to get the grouping behaviour that you desire, right-click the List row header, then Row Group -> Group properties and Group it on
=year(dateAdd("M", -6, Fields!theDate.Value))
This will remove 6 months from each of the dates, and group when they are in the same year (so June 2016 will become December 2015, and be grouped with the other 2015 dates)
When run the report will look like this.
You can then edit the list to insert a page break between each of the tables if you wish, or whatever additional formatting you require.
Hopefully this will assist you. Let me know if I can be of further help.
I need to insert a row into an existing Excel worksheet using C# but keep the existing formatting.
The default behaviour in Excel is to use the formatting of the row above, which in some cases is what I don't want as this could be different.
I am sure I have seen that there is a way to specify using the format of the row below rather than from the row above but I can't find it now.
Does anyone know how to specify this?
This is the code I am using:
sheet.Range[string.Format("{0}:{0}", row)]
.EntireRow
.Insert(
Excel.XlInsertShiftDirection.xlShiftDown);
You need to use the CopyOrigin parameter as well.
sheet.Range[string.Format("{0}:{0}", row)]
.EntireRow
.Insert(
Excel.XlInsertShiftDirection.xlShiftDown,
Excel.XlInsertFormatOrigin.xlFormatFromRightOrBelow
)
See here for details on Insert and that enum.
It is possible to get this parameter by recording a macro. There is a small box that pops up when you insert the row to choose where the formatting comes from.
I have a section in a Crystal Report that I want to suppress. I need to suppress it if there are 0 rows in a particular table in the dataset I am using. How would I do this? The Record Number special field provided appears to be an internal count of records in the report, and does not relate to the rows in the underlying data table.
I am creating the report from C#, but I cannot suppress the section from the code (it doesn't fit the project structure) - I must be able to do it from the report itself. The table concerned is definitely being passed to the report in the dataset, but it contains 0 rows. There must be a way to establish this inside the report itself.....
Can anyone please point me in the right direction?
In the Crystal Reports designer, view the properties of your section and there should be an option to Suppress, which you can give it a formula to return the appropriate boolean value.
You could then use the Count() function within that formula and (I believe) you can pass the name of your dataset to the Count() function to get the number of rows in that dataset.
I did the same thing on a complex report about 3 months ago but I don't have access to the report any more having changed jobs so I'm sorry I cannot be more specific, but hoepfully this gives you a starting point.
Just had a quick Google - try this.
If the section does only contain database fields and f.e. no text fields, then you could use the setting "Suppress Blank Section" in the "Section Export" (rightclick section) for that section.
As an alternative you could use the following formula in the "Suppress" in the "Section Export" for that section:
IsNull({table.field})
"{table.field}" is one of the fields in the dataset.
Hope this helps.
Go to "Section Expert" and click "Supress (No Drill-Down)" and try adding this:
IF {"DragYourFieldHere"} = "" then true else false
Create one dummy group,check on its header for each page,add the header in the group header of the dummy group.
I'll separate this post in 3 sections to be as clear as possible. The first one will be informations you need to know. Second one will be the solutions I tried so far to get this working. Third section will be the questions. I also have to precise that's the first time I'm using CrystalReports.
Informations
I'm currently working with Visual Studio 2010 with C# and I'm using SAP Crystal reports. I'm displaying the data using MySQL database.
Now, here are the tables I use to display the report:
Table : orders
Fields : id(primaryKey), date(DATE), quantity(INT), fksizes(INT), fkclients(INT)
Table : sizes
Fields : id(primaryKey), name(VARCHAR(30)), price(FLOAT)
Relationship between these 2 tables : orders.fksizes with sizes.id
Basically, I'm passing a range of dates as parameters to the Crystal Reports to display informations only between those dates. Then, I created 2 parameters : StartDate and EndDate both of type Date.
What I've tried
Here's the original query I'm using to display what I want without the date range condition :
SELECT sizes.name, SUM(orders.quantity) AS totalQty,
(SUM(sizes.price) * orders.quantity) AS totalPrice,
orders.date
FROM orders
INNER JOIN sizes ON orders.fksizes = sizes.id
GROUP BY sizes.name, orders.date
This query works correctly and display the total quantity sold and the total price for each size name. At the report's footer, I'm using a Summary field in which I got the total sum of all totalQty named sumTotalQty. I have another field for the same purpose for totalPrice named sumTotalPrice.
I have 2 rows of data test which are :
Size name Quantity sold Total Price
------------------------------------------------------------------------------
Big 2 $6.00
XBig 7 $28.00
The field sumTotalQty displays 9 and sumTotalPrice displays $34.00 which is exact results. I have to precise that the first row has 2013-10-29 as value for orders.date and the second one 2013-10-30.
Now, I want to select a range of dates for which I want to display the results. As an example, I select from 2013-10-30 to today, I should get only the second row with sumTotalQty displaying 7 and sumTotalPrice displaying $28.00. I got the single row correctly displayed, but sumTotalQty displaying 9 and sumTotalPrice displaying $34.00 which are incorrect following the date range.
I then tried to add a WHERE clause to my sql query to specify the date range like this (in Database --> Database expert...):
SELECT sizes.name, SUM(orders.quantity) AS totalQty,
(SUM(sizes.price) * orders.quantity) AS totalPrice, orders.date
FROM orders
INNER JOIN sizes ON orders.fksizes = sizes.id
WHERE orders.date BETWEEN '{?StartDate}' AND '{?EndDate}'
GROUP BY sizes.name, orders.date
I got no result displayed with it. So, I think {?StartDate} and {?EndDate} are just not set but I'm really not sure. The same goes for WHERE orders.date BETWEEN #StartDate AND #EndDate.
Questions
Why aren't {?StartDate} and {?EndDate} set even if I have entered a date range when I'm prompted to give them ?
With the original query (without the WHERE clause), how can I get the right result in my summarize fields with the date range given ? It's like it sums from the database and not from the report fields.
EDIT
After many searches, 2 other questions came in my head :
Is it possible to add DateTimePicker in the report so the user will be able to enter a starting date and an end date easily ? The report would be refreshed automatically after that.
Is there a way to create or use Crystal Reports events (OnLoad, AfterLoad,...) ?
Thank you for all help I'll get.
Question 1: You either use BETWEEN (? AND ?) or BETWEEN (#StartDate AND #EndDate)
Question 2: You would have to group your data and then use totals in your report.
Edit: After discovering that the issue is with the parameter declaration, I suggest taking a look at some of the following posts:
http://www.dotnetperls.com/sqlparameter
Why do we always prefer using parameters in SQL statements?
Do some more research and you will find lots of info on the net. What I would suggest is to add some input boxes (TextBox, DateTimePicker, etc.) to your page where the user can input the parameter values and then pass them programmatically to the report. That way you can pass the parameters to the SQL statement and get the correct data to your report. You also won't need parameters in your report.
As far as CR events go, there is the Init event, which is public
http://msdn.microsoft.com/en-us/library/aa691447(v=vs.71).aspx
and then there are some Viewer events that could be useful
http://msdn.microsoft.com/en-us/library/ms227097(v=vs.80).aspx
I have a client report (RDLC) with these specifications. and I am using VS 2008 to implement this
I have a DataSet with 4 Different DataTable for each section. and note that all of the report located in a List in order to print a large group of Data with one request.
Description
all of the report located in a List // to print some different data with one request
At top (in the list) we have a rectangle which include some Textbox to represent common Information
At Middle I have 2 different List which include some TextBox To represent List of Professor and Managers ( it also has to show their Picture, with Name and etc)
Then I have another List to represent The Organizations Information. ( it use some TextBox inside of a List to represent All of the Organizations Information)
As Client Report work with One Dataset. I provide four DataTable for my different Report Sections.
Each DataTable Has an ID for Grouping
The Common DataTable ID use to group the entire of the list for another Object (Here University)
How Can I implement Such a report, While I can't use Different DataTable for grouping because If I do such a Thing I can Display only the First Field of the groups
Any Help is Appriciated
Thank you in advance
The simplest way will be to create an unnormalized data-view by joining your four data tables and then bind your report to it. You have group on ID (that is common to all data tables).
Yet another option would be to use sub-reports but IMO, its more complicated/inefficient to use them instead of above option.