We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

DataBound (Grouping) Grid and Calculate Formula like Rank

Thread ID:





29886 Jun 6,2005 12:30 PM UTC Jun 17,2005 10:13 AM UTC WinForms 5
Tags: GridControl
Tobias Hartmann
Asked On June 6, 2005 12:30 PM UTC

How can you use Calculate formulas like Rank in a DataBound Grid as an Expression field Column. Is this possible? Thanks for your help.

Administrator [Syncfusion]
Replied On June 6, 2005 01:12 PM UTC

In version 3.2 of our GridGroupingControl, we added support for custom functions that you can use in our ExpressionsFields. About midway this forum thread is a discussion of adding custom functions. http://www.syncfusion.com/Support/Forums/message.aspx?MessageID=27198 So, you can add a custom function that would get called when the grid computes an expression value. What you would have to do is in your implementation of this cutom function, use an ICalcData obecjt that would be able to use teh Calculate engine to do this calculation. You could do sort of teh same thing using an unbound column technique for both a GridDataBoundGrid or a GridGroupingControl. The problem will be to implement the proper ICalcData object. This implementation will depend upon several things, including the type of grid. For a GridGoupingControl, it would also depend upon whether you need to support grouping and if you want to see the ranking for the whole table or for within groups. It will take some coding to do this.

Tobias Hartmann
Replied On June 16, 2005 11:04 AM UTC

If I use the mentioned public string ComputeFunc(string s) function I get in s the values of a column in one row but not of all the rows within a group. How would I receive those. Thanks for your help.

Administrator [Syncfusion]
Replied On June 16, 2005 01:04 PM UTC

I may not understand what you are asking. You would have to write the code in your method to access these records. For example, if you are using grouping, then you could pass in the group category that you want to rank as the argument in your ComputeFunc method (and maybe some other information as well). Then you could use code like: Group g = this.gridGroupingControl1.Table.TopLevelGroup.Groups[PassedInCategoryString]; // Iterate through g.Records to access the records in this group

Tobias Hartmann
Replied On June 17, 2005 09:43 AM UTC

But I can''t pass a string into the function. If i try to pass a string with a group name, I get the following error "named functions not supported in expressions". If I pass a column "[ColName]" I get the value in the ComputeFunc. So I don''t know in what row of the grid I am and what column I want to process.

Administrator [Syncfusion]
Replied On June 17, 2005 10:13 AM UTC

You cannot pass the string you want into the Rank function, that is true. But you can pass anything you want into YOUR ComputeFunc. There you can take a string like [ColumnName] and convert it into a list of numbers or into a range like A1:A50 that can be understood by the ICalcDataObject that you are using. You will have to do the latter if you want to actually call the CalcEngine''s Rank function. You would have to implement a ICalcDataObject so the CalEngine knows how to map something like A1:A50 into your datasource. We can try to do a sample for you, but it may be a few days before we can get to it. Submit a Direct Trac support incident requesting it if you would like a sample.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon