Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to calculate a weighted average function in code

$
0
0

This example illustrates how to calculate a weighted average function in the SummaryGetResult event handler. To learn how to solve this task without writing any code, see How to calculate a weighted average function.

In this example, a calculated field's expression returns multiple field values that are parsed in the SummaryGetResult event handler where a weighted average is calculated.

Question Comments

Added By: Abdul Shareef1 at: 3/12/2013 3:13:38 PM    

Can you please explain me how to do the following step for two numeric fields?

To do this, create a calculated field and in its expression, refer to two data fields and separate them using a special sign (such as "|").

Added By: George (DevExpress) at: 3/14/2013 5:50:49 AM    

Please open this project in Visual Studio, and in the Field List panel, right-click the "fieldWeight" calculated field. In the invoked popup menu, select "Edit Expression...", which runs the field Expression editor. In this editor, you can view the following expression: ToStr([UnitPrice] * [UnitsInStock]) + '|' + ToStr([UnitPrice])

Added By: Farukh Sharipov at: 6/14/2013 4:09:28 PM    

Can you explain more how to do two numeric fields? Maybe attach screencast?


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>