using cint function in expression editor

Hi, I am a new to Reporting Services...

I am using RS2000

I am trying to apply cint function in the expression editor for the textbox

eg. i type in =cint(Fields!firstfield.Value/Fields!secondfield.Value).

This is returning error

The value expression for the textbox ‘HoldDuration’ contains an error: Arithmetic operation resulted in an overflow.

Could you please let me know what I did wrong in this and how to correctly apply VB or any custom functions in the expression editor where the expession output would be a decimal value and you are interested in getting an integer value by rounding the fractional part.

[702 byte] By [reportsvsnew] at [2008-1-2]
# 1

You may want to ensure that both values can be converted to integers before doing the division. IsNumeric function may help, or try doing the conversion on each field individually.

There may also be a problem with dividing by 0 though this should throw another error.

cheers,

Andrew

Andrew-T4G at 2007-9-13 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...
# 2

Hello Andrew, thanks for your reply.

both the values i am passing are integers....if I just include value1/value2 in the expression editor without passing the value into any function, it displays an integer correctly on the report rounded to the nearest value, but if I pass the value through a function,that is when I get this error...infact i wanted to format the display correctly using a custom code function but it threw the error. I wanted to try with another built in function first to narrow the source of the error like CInt and it also threw the same error....

Thanks,

reportsvsnew at 2007-9-13 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...
# 3

Here is a post that may be related.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1444821&SiteID=1

You may want to try =Convert.ToInt32(value1.ToString()) / Convert.ToInt32(value2.ToString())

or try using the Report Code and creating a function.

Here is another link, with references to 'divide by zero' but it may have some good things to try.

http://dotnet.org.za/derek/archive/2005/12/09/48729.aspx

cheers,

Andrew

Andrew-T4G at 2007-9-13 > top of Msdn Tech,SQL Server,SQL Server Reporting Services...

SQL Server

Site Classified