reporting services - How do I return 0 instead of #Error? -


i have following expression.

=fields!avglosc4.value.split("|"c)(0) 

occasionally, returns #error instead of value. if above expression results in error, how return 0 instead of displaying #error?

split or iif checks won't work ssrs doesn't short circuit on these , if part fails whole expression errors.

you can around custom code. add following code report:

function firstsplit(fieldvalue string) string   if isdbnull(fieldvalue) orelse isnothing(fieldvalue)     firstsplit = "0"   else     firstsplit = fieldvalue.split("|")(0)   end if end function 

call code in cell with:

=code.firstsplit(fields!avglosc4.value) 

with dataset generated by:

select avglosc4 = '1|2' union select avglosc4 = '1' union select avglosc4 = null 

you can generate report like:

enter image description here


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -