i working on report , in 1 of fields is
=(reportitems!textbox1.value-reportitems!textbox2.value) /(reportitems!textbox1.value+reportitems!textbox2.value)
which division of previous 2 fields , if have values these fields correct value,but if dont have values previous 2 fields mean if empty returns me #error.
so used vb.net code below
public shared function varpercent(byval actual decimal, byval budget decimal) decimal if budget = 0 return 0 end if return (actual / budget) end function
use expression below
=code.varpercent(reportitems!textbox1.value-reportitems!textbox2.value) /(reportitems!textbox1.value+reportitems!textbox2.value) worked nicely.
see problem when try add sum of fields below
=code.varpercent(sum(reportitems!textbox1.value-reportitems!textbox2.value)) /sum((reportitems!textbox1.value+reportitems!textbox2.value) )
am getting #error, righr way add sum function in expression? if yes,how can use sum function in above expression? give alterenate solutions?
thanks,
samba
try casting values appropriate type (...cint(), cdbl()...).
cdbl(reportitems!textbox1.value)
Comments
Post a Comment