Crystal Report Script To Find Title of Max Value?(simple Q!) - c#

Please Help!
I asked my Q in many Forums but i did'nt recieve any clear answer.
This is my Q:
I created a table in a Details Section and I have a Title Col and Point Col in this table how can I write code to find Title of max point in my table???
this is my .rpt overview:
(source: googlepages.com)
you see i have 3 cols in Details Section. Point,BitParagonTitle,Alphabet.
I want to show BitParagonTitle to user according to Maximum of point in footer of report.
How can I perform this in Crystal report? please Help me!!!
So I want to:
Find Maximum Value of point Column.
Find title of Max Point.
I created a collection of Data Object in an ArrayList as report DataSource.
Please Help me to write some crystal report scripts to find Title of Max Point and show it in Group Footer.
This is Important that I dont use SQL DB Procedures or tables as data source and I Collected Data manually as I said.

I am not sure of all of your requirements, but if you don't mind the Details being sorted the easiest way is to group by the Point column and then if the points are sorted ascending you can simply put the field title and point fields in the Point group footer. This will only display the last row of the Point column which in turn will be the maximum since it is sorted asc.
This will give you the maximum row so if you didn't care to see the other rows you can simply suppress the details section. Hope this makes sense and helps.

You'll need to use a pair of global Crystal variables in a formula that is evaluated in the Details section, as well as two other formulas referring to those variables.
The two variables are to store the max of point, and the title associated with that (so presumably a NumberVar and a StringVar, say called MaxPoint and MaxPointTitle).
One formula goes in the Report Header, and simply initialises the two variables to zero and empty string.
The second goes in the Details section. It evaluates if the current Point value is higher than that stored in the MaxPoint variable. If so, it stores the new value in MaxPoint and the current title in MaxPointTitle.
In the Report footer, a third formula is used to display the title and/or value.
If you want group max values rather than overall ones, move the formula in the Report header to the Group header, and from the Report footer to the Group footer, and it should work.

Related

crystal reports fix group section height

I want to set the height of group section in crystal report. I want to set the group section such that it must at the most accommodate 10 records in the section.
If I have only 2 records in the section, it should show 8 empty lines.
If I have more than 10 records in the section, the remaining records will be placed on the next page.
After that, the footer will be printed at the end of it.
Is this possible as i didnt get any solution even after lot of searching
Its a typical requirement but will try to provide solution. There is no need to increase the size of the group section just Try Below given way.
1. Insert 11 group sections.
2. Place the data field in 1st group section.
3. In the remaining 10 group sections place a line and write the supress condition for individual group section on the number of records retrived. For e.g if 5 records are retrived then 5 group sections with lines should get displayed and remaining sections with lines should get supressed, If 10 records are retrived then all 10 sections should get supressed.
Note: This is not a tested code.
I have seen requests like this before and they never quite work out due the way CR is structured. To limit your group to only show 10 records, you go into the Section Expert and under the paging tab you can check "New Page after 10 visible Records".
As far as the blank lines go, you could try and create a formula that will insert blank lines if the total of lines is less than 10, or you could try to display the records using a subreport that you format accordingly.
What you need to do instead of suppressing the band is to suppress the fields instead.. That way the band height remains even if the fields dont print

C# Replacement String

Hi To All Good Programmers,
I am developing a web-based app in which I need to generate some kind of reports. To do that, I prefer to use .rdlc embedded in VS 2010. There is a report named 'AccountReport' in which table rows are grouped according to some field of the table and it works fine.
The Problem: I need to add the Sum of a column as the last record of each group, the Sum is not a field of database table.. So How can I group it?
Here is a snap shot of what I need as the result. I have it already except the last record(row).
How Can I rich the 'Total' Record? It is grouped by the 'Current Asset'. This image is prepared using MS Word of course.
Any Idea pleas?
You need to use the Sum Function of Visual Studio Report Designer. Add a row in your report to show the total. Use the SUM function with your desired columnn name to set the expression. Check this answer for step by step pictorial details Sum of Column Values in rdlc report.
See similar question here

How to get a column total in a Winforms Pivot Grid control

I need to display the percentage of each cell, of a pivot grid, column against its column total.
So far, I have been checking possible ways to get the columns totals being displayed by the PivotGrid (as I already know how to insert a computed column using expressions) but so far I haven't found a place where these values are available.
I have also considered to handle the CustomSummary or CustomUnboundFieldData events of the PivotGrid but I don't see clearly how can I get the column total from there.
Another approach I have think of is to try to use the PivotCellBaseEventArgs.CreateDrillDownDataSource to get the underlying records of the cell, but then I will not be able to get the column total, as the records returned by that method are only for a specific cell, not for the whole column.
I'll appreciate if you can point out what would be the best approach for dealing with the cell percentage against column total requirement, including any of the previous or maybe another approach I haven't think of.
Also I will be glad if you show me a way of getting the column total from the pivot grid control, if there's any way.
I finally find the way to do this so I am posting it in case anyone else need it...
There is a property on a PivotGridField that allows you to control the way the data is "summarized" (i.e. aggregated). Usually this is set to "as is" or Default but you can change this to support what is called Percentage Modes.
So I just change the PivotSummaryDisplayType, of the field that I wanted to display as percentage, to PivotSummaryDisplayType.PercentOfColumnGrandTotal and that's it.

RDLC reports: Show textbox value if first row on page

I have an old report written by someone else and don't want to change it too much. Each data row has a field at the beginning that is populated with the Category name if it is the first record for that Category and is left blank for all the others. A total line follows at the end of a Category section.
I works fine except when there is a page break between the first record and the last. In this case it is hard to tell what the category is since it is on the previous page.
My question is if there is a way to tell if a row is the first on a page? I tried
=IIf( (RowNumber(Nothing) = 1), Fields!DepartmentDescription.Value, "")
but that only shows the category for the first record in the category (which is already done using).
RowNumber("tblMain_DepartmentGroup") = 1
Not the first record on the page.
Thanks for any help.
You could have easily used the First() function. It literally receives and uses the first value it gets from the data collection.
Yes, it's possible. No, it's not easy. It would require some custom VBscript code (to be found in Report Properties). You might be trying a wrong approach.
In this case I would recommend to repeat some of the heading on new pages. Select 'Advanced Mode' at the little arrow next to Column Groups. In your row groups, a couple of extra (Static) items appear. Select the correct ones, and set 'RepeatOnNewPage' to true.
To give us some more context, it might be useful to know what you want to achieve with this.

Crystal Reports Omitting Data

This might be a pretty simple question but I'm a Crystal Reports newbie...I have a report where I want specific pages that have a corresponding column omitted. So for example say it has someone's name and information on every page, how would I use a column that for example has the state on it, to omit certain results, like I don't want any pages in the report generated from states that have the "state column" from the database equal to like "TX" or something. This isn't what I'm actually doing, but it's an example of the functionality I want.
I'm thinking it would be in either the group or record selection formulas but I'm not sure how to go about putting it together to not create a page for the results when a certain column is equal to a value.
-Thanks from a total Crystal Reports noob.
So each page of the report is one record in the result set (someone's name and information) and you want to exclude some pages based on the value of one of the columns?
Perhaps I'm not understanding the problem correctly but can't you just change the datasource query?
WHERE state <> 'TX'

Categories

Resources