Concatenate Fields

Posts   
 
    
BSAPD avatar
BSAPD
User
Posts: 42
Joined: 02-Jul-2004
# Posted on: 26-Oct-2004 20:58:36   

I have not found a good way to do this. I want to take two columns and put them together like: PersonEntity.FirstName + ", " + PersonEntity.LastName. I want to be able to bind on this new column. I found a couple of old posts about this but I am wondering if there is a better solution now.

Please Help! cry

BTW: I am using the Adapter model.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39613
Joined: 17-Aug-2003
# Posted on: 27-Oct-2004 10:09:07   

BSAPD wrote:

I have not found a good way to do this. I want to take two columns and put them together like: PersonEntity.FirstName + ", " + PersonEntity.LastName. I want to be able to bind on this new column. I found a couple of old posts about this but I am wondering if there is a better solution now.

Please Help! cry

BTW: I am using the Adapter model.

2 solutions: A) - use an custom template set config file (make a copy of the CSharpTemplateSet.config file and change the <name>tag contents) and bind Custom_EntityAdapterTemplate to a new template file, for example myEntityProperties.template - in myEntityProperties.template, add a TDL statement: <[If StringValueEquals CurrentEntityName "Person"]> public string FullName { get { return this.Firstname + ", " + this.LastName; } } <[EndIf]>

  • generate the code using this new template set config file.

or: B) - download the extended adapter entity template set from the 3rd party section and generate code with that template set - in the derived entity class from PersonEntity, add the property

In both cases, you will be able to bind to the column, as it is a normal property.

Frans Bouma | Lead developer LLBLGen Pro
swallace
User
Posts: 648
Joined: 18-Aug-2003
# Posted on: 27-Oct-2004 14:38:53   

I notice you're in the US Coast Guard. I had two brothers who served, one toured the world on The Eagle. They loved it. The older brother retired after 24 years service. Every time he gets up to New York he visits the grave of Alexander Hamilton to pay his respects.

Best of luck.

BSAPD avatar
BSAPD
User
Posts: 42
Joined: 02-Jul-2004
# Posted on: 28-Oct-2004 20:19:01   

Otis,

Thanks for your response. That sounds like a very good way to solve my problem. I will give it a try.

swallace,

I only served 5 years but I am still a BIG fan. I will always have a lot of respect for those guys. Unfortunately I never got to sail the Eagle but I did get a tour when my ship (Storis) was in San Diego for training from Kodiak Alaska. Now that is a beautiful ship!

Brian

rdhatch
User
Posts: 198
Joined: 03-Nov-2007
# Posted on: 07-Nov-2007 18:11:36   

Hello all. Just to help others...

I have a Calculated Field (String Concatenation) working. This works well for me:

Imports SD.LLBLGen.Pro.ORMSupportClasses
Namespace MyDataObjects.TypedListClasses
    Partial Public Class MyTestTypedList

        Protected Overrides Sub OnInitialized()
            'Create custom column
            Dim colSummary As New DataColumn("Summary", GetType(String), "Field1 + Field2", MappingType.Element)
            Me.Columns.Add(colSummary)

            'Call Base
            MyBase.OnInitialized()
        End Sub

    End Class
End Namespace

Best of luck! God bless,

Ryan D. Hatch

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 08-Nov-2007 04:39:22   

Thank you for sharing this wink

David Elizondo | LLBLGen Support Team