Friday, February 24, 2012

Custom Code

I have been reading a little about custom code - Where do I type this code at in the report? Does anyone have a sample report or info they could pass along? Sorry about the dumb question , but i am a newbie and I am not so bright...you click on Report - Properties and click on Code tab. there you can write your vb.net functions..
sample CC :

Public Shared Function RetCardHolderName(lastname as string, middle as string,firstname as string) as String
If ( firstname is system.dbnull.value OR len(trim(firstname))=0 ) Then
return ( trim(lastname))
else
if ( middle is system.dbnull.value OR len(trim(middle))=0 ) Then
return (trim(firstname) & " " & trim(lastname))
else
return (trim(firstname) & " " & trim(middle) & " " & trim(lastname) )
end if
end if
End Function

I wrote this CC to return the first, middle and last names concatenated as one string.

from the report I pass the parameters as :
in the Expression window for the field :

=Code.RetCardHolderName(Fields!LAST_NAME.Value, Fields!MID_NAME.Value, Fields!FIRST_NAME.Value)
|||Thank You! The example was also a big help!

No comments:

Post a Comment