expressions in report in .new

  • Thread starter Thread starter Gerhard
  • Start date Start date
G

Gerhard

I am working with a report (.rdlc) in visual studio 2010 with Report Viewer.
All is working well, except that there is one thing I haven't been able to
locate the syntax on. I have a subtotal of count ( [Sum(CountRow)] ) and a
subtotal of elapsed time ( [Sum(CurrentElapsedTime)] ), both of which display
correctly. The question is how do you write the syntax to get the average
(elapsed time / count)? I tried using the expression builder and came up
with =Sum(Fields!CurrentElapsedTime.Value) / Sum(Fields!CountRow.Value), but
that gives an error when running (count is never 0 by the way, so that isn't
the issue). What would be the correct syntax for this? Thanks.
 
Hi Gerhard,

Since we didn't get the error details, I just suggest you to check the
following points which may cause the problem.

First, could you pleaes try to check if fileds
(CountRow/CurrentElapsedTime) are available at current scope, and if the
data type of those fields are Integer/Float, if not, it can not be used in
aggression functions like Sum().

Second, although you have mentioned the CountRow.value will not equal to
zero, but I still suggest you to use the following expression to show the
data.

IIF(Sum(Fields!CountRow.Value)=0,0,Sum(Fields!CurrentElapsedTime.Value) /
Sum(Fields!CountRow.Value))

Third, if the above steps doesn't help, please show
Sum(Fields!CurrentElapsedTime.Value) and Sum(Fields!CountRow.Value)
separately in two report textboxes, and the average value should be
textbox1 / textbox2, try to check if that works.

--
Sincerely,
Zhi-Qiang Ni
Microsoft Online Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

MSDN Managed Newsgroup support offering is for non-urgent issues where an
initial response from the community or a Microsoft Support Engineer within
2 business day is acceptable. Please note that each follow up response may
take approximately 2 business days as the support professional working with
you may need further investigation to reach the most efficient resolution.
The offering is not appropriate for situations that require urgent,
real-time or phone-based interactions. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
 
Back
Top