23

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.

See the circled fields that I want to concatenate

Cœur
  • 37,241
  • 25
  • 195
  • 267
asma
  • 2,795
  • 13
  • 60
  • 87
  • 1
    hi asma, but in rdlc you need to write the custome code in vb only there no other language supported by it – Pranay Rana Apr 05 '11 at 19:33
  • 1
    @Pranay Rana : you did not see my comment under your post that I sent on 5th of April, then what's my fault? I replied but you didn't give any response. How could I accept your answer ! – asma Apr 12 '11 at 12:35
  • Sorry for that asma, it wouldn't take you personally. Stackoverflow could have better guidance for new users. Anyway... I had hope on you that's why I gave you my answer. Good luck!! – Eduardo Xavier May 03 '11 at 19:54
  • 1
    @Eduardo Xavier - ironically asma now has more rep than you :P – demoncodemonkey Jan 04 '12 at 08:44
  • it's an interesting thread. You forget about the coding issue and try figuring out chemistry behind all those comments :D – Faran Shabbir Dec 09 '21 at 20:24

2 Answers2

44

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

Eduardo Xavier
  • 1,520
  • 21
  • 29
0

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

Pranay Rana
  • 175,020
  • 35
  • 237
  • 263