4 Answers, 1 is accepted
0
Hello Seb,
Let's assume that you have a text box which value is for ex. total sales:
=Fields.Quantity * Fields.Price
To calculate the average of the above just add a text box to the report or the group footer section (page sections does not allow expressions with data fields!) and use an expression like this:
=Avg(Fields.Quantity * Fields.Price)
All the best,
Svetoslav
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Let's assume that you have a text box which value is for ex. total sales:
=Fields.Quantity * Fields.Price
To calculate the average of the above just add a text box to the report or the group footer section (page sections does not allow expressions with data fields!) and use an expression like this:
=Avg(Fields.Quantity * Fields.Price)
All the best,
Svetoslav
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0

Maxime
Top achievements
Rank 1
answered on 03 Dec 2007, 10:35 AM
Hi,
No, it's not possible... The value of my textbox is calculated with a user function.
The only way I saw, is when the texbox is databound, to store the value and then to calculate manually the average.
It is not practical because the sums must be given to zero at each beginning of section.
And the value that I recover in the event databound can be formatted for display...
All ideas are welcome...
Regards,
0

Maxime
Top achievements
Rank 1
answered on 05 Dec 2007, 09:17 AM
Hi,
In the ItemDataBinding event can I retrieve the value tht will be set in my textbox.
The value is calculated bu user function.
Regards,
In the ItemDataBinding event can I retrieve the value tht will be set in my textbox.
The value is calculated bu user function.
Regards,
0
Hello Seb,
Summaries can be made on User Functions in the same way as you make them on data source fields. For example, if your summary function is:
public static double CalculateOrderPrice(double unitPrice, int amount)
{
return (unitPrice * amount * 1.20); //add VAT :-)
}
and your data field names are UnitPrice and Amount, you can set the following expression as the Value of a TextBox and it will calculate the Average on the results returned by the User Function:
=AVG(CalculateOrderPrice(UnitPrice, Amount))
I have prepared a little project containing a report that demonstrates the above. Examine it carefully and if you have any other questions, do not hesitate to contact us again.
Best wishes,
Ross
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Summaries can be made on User Functions in the same way as you make them on data source fields. For example, if your summary function is:
public static double CalculateOrderPrice(double unitPrice, int amount)
{
return (unitPrice * amount * 1.20); //add VAT :-)
}
and your data field names are UnitPrice and Amount, you can set the following expression as the Value of a TextBox and it will calculate the Average on the results returned by the User Function:
=AVG(CalculateOrderPrice(UnitPrice, Amount))
I have prepared a little project containing a report that demonstrates the above. Examine it carefully and if you have any other questions, do not hesitate to contact us again.
Best wishes,
Ross
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center