How to concatenate values in RDLC expression?

半世苍凉 提交于 2019-12-04 02:47:01

问题


I have an RDLC file in which I want to make an expression. Here is the image of properties of expression. I need to concatenate First Name, Last name and Middle Init.


回答1:


The following examples works for me:

=Fields!FirstName.Value & " " & Fields!LastName.Value

or

="$ " & Sum(Round((Fields!QTD_ORDER.Value - Fields!QTD_RETURN.Value) * Fields!PRICE.Value,2), "Entity_orderItens")

Have a look at MSDN




回答2:


Check this : http://blogs.msdn.com/b/mosharaf/archive/2005/12/20/localreportcustomcode.aspx

it is possible to do in a different way in the rdlc report you can use VB code. Just click on the report with right mouse button. When the context menu from where you enter parameters go to Proprties. When clicking it you should see a tab control witch few tab pages. Go to tab page "Code" an there right you VB function it must be something like this

     Public Function concatestring(ByVal val1 As Object,ByVal val2 As Object,ByVal val3 As Object ) As String
//         return val1 + ' ' + val2 + ' ' + val3 -- just string cocate in vb will do your task
        End Function

Then call the function in your textbox like this

= Code.concatestring(Fields!MyField_1.Value,Fields!MyField_2.Value,Fields!MyField_3.Value )

P.S. I am not very sure if the VB code is working correctly just test it and if it is needed rewrite. If any other error occurs please post it to see what is the problem



来源:https://stackoverflow.com/questions/5552292/how-to-concatenate-values-in-rdlc-expression

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!