Concatenating Fields

Posts   
 
    
smurrell
User
Posts: 59
Joined: 22-Feb-2007
# Posted on: 12-Mar-2007 13:19:45   

Hello

I have 3 fields for a User Entity, namely FirstName, Surname and Username. I have defined a TypedList which contains these 3 columns. I would like to add an additional field to the TypedList called Fullname. However the designer does not allow me to do this so I would like to do it via code.

I basically would like to create the Fullname column like this

FirstName + " " + Surname + "(" + Username + ")"

How would I achieve this so the Fullname is returned in the resultset back to the client.

Regards, Simon

Aurelien avatar
Aurelien
Support Team
Posts: 162
Joined: 28-Jun-2006
# Posted on: 12-Mar-2007 14:32:09   

Hi,

you can add code in an entity file between region designed fot that :

' __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode

        Public Readonly Property Fullname () As String
            Get
                Return Me.FirstName + " " + Me.Surname + "(" + Me.Username + ")"
           End Get
         End Property

' __LLBLGENPRO_USER_CODE_REGION_END

smurrell
User
Posts: 59
Joined: 22-Feb-2007
# Posted on: 12-Mar-2007 14:43:14   

Aurelien wrote:

Hi,

you can add code in an entity file between region designed fot that :

' __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode

        Public Readonly Property Fullname () As String
            Get
                Return Me.FirstName + " " + Me.Surname + "(" + Me.Username + ")"
           End Get
         End Property

' __LLBLGENPRO_USER_CODE_REGION_END

Hello Aurelien

How do I add this column to a TypedList though?

Regards, Simon

Aurelien avatar
Aurelien
Support Team
Posts: 162
Joined: 28-Jun-2006
# Posted on: 12-Mar-2007 15:13:46   

Ok, I didn't get you are using a TypedList. the code in my previous post is for an entity.

By the way, there are also code region for TypedLists. You can learn more on code region by reading this page on LLBL documentation Generated code - Adding your own code to the generated classes.

Cheers

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 12-Mar-2007 21:04:44