Repeat header based on user choice - c#

I have a report subreport with a group and the option "Repeat group header in each page" checked. But I need the user to be able to choose whether or not to show the group header on every page, or just the first time the group appears.
I set up a checkbox to let them choose, but how can I use this to tell the report not to repeat the header during run time?
Update
Beeing a Subreport I can not know which page will appear for the first time and I can not restart the numbering because it is necessary for the report.
I'm using CrystalReports in VS2005 and coding C# in VS2010, I'm working for a company and can't upgrade.
I'm trying to use a FormulaFieldDefinition in C# but I don't know how.

This could be done with a variable inside the sub-report.
Create a formula-field with following content and place it somewhere in the detail-section:
WhilePrintingRecords;
booleanVar headerPrinted := True;
In the suppresion-formula of the group-header place the following code:
WhilePrintingRecords;
booleanVar headerPrinted;
The formula will set the variable to True as soon as the first detail is being printed.
So the suppression formula evaluates to False only the first time the group header is being printed and to True on every subsequent time.
So with a boolean parameter {?GroupHeader} to choose if the header should be printed or not the suppression-formula would look as follows:
WhilePrintingRecords;
booleanVar headerPrinted;
If {?GroupHeader} And headerPrinted Then
True
Else
False
{?GroupHeader} = True would mean: Only show group-headers once.

I'm not sure which version of Crystal Reports you are using, but it does not look like there is an ability to specify a formula for "Repeat Group Header on each Page" under the Group Expert in Crystal 2011.
Instead, you might have to do a work around:
Create a boolean parameter {?GroupHeader} where true means "show the group header on every page."
Create a page header.
Copy your group header elements into the new page header.
Create a suppression formula on the new page header section under the Section Expert.
if PageNumber > 1 and {?GroupHeader} = true then false else true.

Related

In ASP.NET web forms is it possible to use RDLC Reports and have the ability to place a tick mark/check mark in cells of a particular column?

I have an RDLC Report Table which retrieves data from a SQL Server.
I've embedded this report into an ASP.NET Web for (.aspx file) using the ReportViewer Control.
When I run the application the Data is retrieved from the SQL Server.
However, I need to have a column where the user has the ability to place a tick mark in the cells of that column.
Obviously I'm able to add a column to the Report itself in the .RDLC file but I'm not able to figure out how to get the tick mark for the user working.
Any ideas how this could be achieved?
Not 100% sure what you mean by:
Obviously I'm able to add a column to the Report itself in the .RDLC file but I'm not able to figure out how to get the tick mark for the user working.
I mean, we don't have a check box control for RDL reports.
And RDL seems to struggle with boolean values.
However, for given columns?
Add a column to the data source/query - cast the boolean column to number - it will still spit out 0 (false) and 1 (true).
Then in the RDL report, you have two choices:
You can add/drop in a check box image, and display it based on the value of the colum above.
But if you want a check box, and un-checked?
You can drop in a indicator. There are a few built in ones. Pick the one with a check box and a "x" for un-checked. it has a seperator also built in - remove that.
So, you get this:
So, using that indicator - 0 to 0, it will display the X, and for 1 to 1, the check box.
You get this effect:
So, it not sure if you ONLY want a check box for true rows, or you want a check box, and a un-check box as per above. You not limited to using a "indicator" on the report, but it for sure the easy road if you need both check and X.
You also are free to input a image, and only show it as true for the column in question that has true values. However, you can't stuff two images into a single column, so indicator becomes the better choice.
Edit: this is only for display - user can't change these while viewing report.
So to be clear, this gets you display, but does not get or give you ability to check or uncheck the boxes in the report.
If you need that ability I'm afraid you are out of luck.
You might be able to present data in a grid view or better yet a listview, allow users to check/ uncheck and then have a view report button.
This also suggests that the data has an extra column for this purpose.
I don't believe that rdl reports have this interactive ability

How to toggle (Expand/Collapse) group data in rdlc

In my rdlc report,I want to show my group data just like this example--
When I click (+) sign group data under the name will expand and When I click (-) sign group data under the name will collapse.I find resources for SSRS report, but nothing useful for rdlc report in recent times.So I followed in my rdlc according to those SSRC report resources if i can get some result.I followed this two specially--
SQL Server Reporting Services(SSRS)
Expand or Collapse All Grouped Items on SSRS Report
I took a table.take "GROUP2" as row details.add group parent "GROUP1" for "GROUP2".Like---
I select group properties for "GROUP2" like--
then i set visibility hide for "GROUP2" , checked "display can be toggled by this group item" and select "GROUP1" as item.like--
It gives me report like this--
there is "GROUP1" item visible, "GROUP2" is hidden but no (+) or (-) sign or button to expand or collapse group data.
Any one have any idea,What i am missing? or how can i do this in rdlc report like the top example of this question and also i want to set button for "Expand All" and "Collapse All" for this report.
EDIT: I am using asp.net mvc, web api-2 controller.I am tring to get report in pdf format.
First you need to select your column/row group and select group properties.
And then select the grouping item from your DataSource
There you go:
Before expanding of group
After expanding of group
First select the table cell showing [GROUP1], and in the Text Box Properties note the Name. This is not necessarily GROUP1, it could well be Textbox10 etc.
Then in the Text Box Properties for the table cell showing [GROUP2], select that Text Box name below "Display can be toggled by this report item:".
BTW you are likely wasting your time trying to use the expand/collapse functionality in SSRS. It is generally considered flaky and unreliable, and does not scale.
PDF format does not support toggling.
Ref:
https://msdn.microsoft.com/en-us/library/dd255288.aspx
(section titled: Toggle items within a report)
"PDF - The report server exports the current show or hide state of the report to PDF. Interactive toggling is not supported"
#MohammadSadiqurRahman Not sure if you got this problem solved but this is something I do that I hope may help you out.
You will need to make sure that your row groupings have been applied correctly. In the example you gave at the top of your post the row group parent would have been set to account type. You would need to make sure this is done for your 'GROUP1'.
Once you have done this set the row visibility for your collapsed row to 'Hide'. Now check the checkbox 'Display can be toggled by this report item' and set the report item to the cell name for the grouped account types.
Personally I attach it to a new label outside of the tablix which will allow for the entire table to expand/collapse with one click. Just depends on how you want it to work.
I hope this helps you out.

How to Supress Blank Space In Crystal report

I have Crystal Repot Like this :
In this I dynamically Supress Field as I I found Null value for that field,
But In Report It shows Blank Space Like here I am Hiding, tag0 ,tag1, tag11, value0 ,value1 ,value11 etc
So Report Shows Like this
I want to Remove this blank Space between Field, above and Below I try
Section Expert => And Tick On Suppress Blank Section , but its not Working
As per Siva Suggest me i Can not Put All the tag in Different Section Because there are in Group Section not in Details
Here Field TAG 0 to 11 and Value 0 to 11 are Variables , which may be hidden or Visible Depend on User Selection , where other Field are static
Try the following step
= > Open your section expert (right click on some white space, you should see it come up).
= > Go to the options for the group footer and turn on reset page numbers after. You should see the page numbers reset at the beginning of each report.
= > Also in the section expert, go to the options for the page header and click on the blue button next to the Suppress (No Drill-Down) option.
= > In the Formula Editor, enter PageNumber=1
I would suggest you to place one tag in one details section like
tag1 in detaila
tag2 in detailb and so on
Then supress the section insetad of supressing the individual fields then you won't get this blank space.
Right Click on the section >> Section Expert >> Check Suppress Blank Section

How to display 20 records on every page of crystal report?

I am new to crystal reports and I need to print 20 rows of data per page.
I found this on the web but it is not working on my system.
if Remainder(Recordnumber,20)=0 then true else false
My system only prints a row per page.
To show 20 records per page do the following
Open the report in Design View
Right click on the Details section and select Section Expert
Make sure the Details section is selected in the Section Expert dialog box. Check the box that says “New Page After”
Click the formula editor button to the right of the checkbox.
Enter the following formula
if Remainder (RecordNumber, 20) = 0 then true else false
Click Save and Close and then click OK.
To make it show 10 records per page do the following
Open the report in Design View
Right click on the Details section and select Section Expert
Make sure the Details section is selected in the Section Expert dialog box. Check the box that says “New Page After”
Click the formula editor button to the right of the checkbox.
Enter the following formula
if Remainder (RecordNumber, 10) = 0 then true else false
Click Save and Close and then click OK.
If you run the report it should break after each 10 rows.
Could it be something pedantic as RecordNumber is Recordnumber in your code?
if Remainder (RecordNumber, 20) = 0 then true else false
If you are using Crystal reports 2008/2011 there is a new options in the details section properties in the section expert - 'New page after: X Visible Records':

Crystal Report grouping end of page

I have a crystal reports with grouping, there are about 3 to 4 groups per page.
But at the end of the page a group is split between two pages, and sometimes there is only the group name, but the group details are on the other page.
I was wondering if there is a way to force ONLY the group that spans 2 pages to start at the next page.
I'm using the C# with visual studio 2008.
Regards,
The simple answer is to start a new page on each change of group.
There isn't an easy way to determine whether the combination of group header, group details and group footer would be split over two pages (so that you can then start a new page for the group header). The normal way to deal with this is to check the "keep together" option in each of the group sections (as described by Kangkan), and to repeat header items where necessary in page headings.
There is a complicated way to do this - by determining how much has already been printed on the current page, then calculating how large the next combined group will be and entering a conditional formula in the Group Header section against the New Page Before option. However, it is quite tricky to write and hard to maintain, as the conditional paging formula will need to be re-written if there is any change to the length of any of the sections in question.
EDIT - repeating group header items in page headers -
Say you wanted to repeat the grouping item under the column headings, where a group was split over two pages:
Split the existing page heading section into two subsections, with the column headings in the first subsection;
Add the grouping item to the second page heading subsection;
In the section expert, set the conditional formula for the Suppress (No Drill-Down) option for the second page heading subsection to be RecordNumber = 1 or Previous ({fieldname}) <> {fieldname}
There is an option to set it and it is called "Keep together". See the property page (in the section expert) for the group and check the "Keep together" option. This will solve your issue.
Also, there are options for "New page before" and "New page after" for every section. You can insert a page break accordingly.
As Mark said, it is very complicated to find out whether a group (along with its content and footer) will be accommodated in the remaining part of the page. So, the natural way is to start a group from a new page and to repeat the group in the page header if required.

Categories