sql server - ms SSRS 2008 R2: Display Computed Values #Error -
the report display 2 columns foo , bar
some rows of foo empty have numerical value:
foo: +----+ | | +----+ |10.0| +----+
then there bar column, column take values foo , add 10 them, report should yield results this:
foo: bar: +----+----+ | | | +----+----+ |10.0|20.0| +----+----+
thats expression use determine whether foo numeric inside bar:
=isnumeric(reportitems!foobox.value)
and result expression yield:
foo: bar: +----+-----+ | |false| +----+-----+ |10.0|true | +----+-----+
okay, thats way want far, write expression way:
=iif(isnumeric(reportitems!foobox.value), reportitems!foobox.value +10, "")
this yield following results:
foo: bar: +----+------+ | |#error| +----+------+ |10.0|20.0 | +----+------+
and bizare, when remove little addition in truepart of iif, execute:
=iif(isnumeric(reportitems!foobox.value), reportitems!foobox.value, "") foo: bar: +----+------+ | | | +----+------+ |10.0|10.0 | +----+------+
it's if "wrong" part of ternary operator gets executed anyway, generating casterror or whatever might be.
how can convert values in order show results explained before?
indeed - using iif cause both statements (true , false) evaulated , leads error getting.
being in situation, create own function handle - can place in code field of report (click outside of page area access report object)
your function might this:
public function myadd(val object) nullable(of integer) if typeof(val) integer return val + 10 else return nothing end if end function
you might need play types used (object , nullable of integer maybe not work you)
then, of course, use myadd in expression , pass reportitems!foobox.value parameter
Comments
Post a Comment