New EntityField by concatenating int and string

Posts   
 
    
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 28-Sep-2012 14:26:52   

Hi, i have a method that i am trying to create a data table and i am trying to create a new field by concatenating two fields. If both fields are the same type there is no problem but if the fields are of different types i dont know how to do it.

any ideas?

i want to create a new field as:

new EntityField(Entity1.Id + "~" + Entity2.Name, "IdAndName"...)

i think i have to use dbfunctioncall but i am not sure how to use it here. or if there is an easier way i would like to know.

thanks

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 29-Sep-2012 06:24:20   

Hi Shane,

Are you fetching a DynamicList or just doing that for filter purposes?

If you just want to concatenate two fields, Why don't do it in memory with a custom property?

public partial class Customer
{
     public string FullName
     {
          get {return string.Format("{0} {1}", this.FirstName, this.LastName); }
     }
}

If, for some reason you want to do it on the server, then yes, use a DBFunctionCall. Examples: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=16711&StartAtMessage=0&#93484 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=20410&StartAtMessage=0&#115077 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=20410&StartAtMessage=0&#115033

David Elizondo | LLBLGen Support Team
e106199
User
Posts: 175
Joined: 09-Sep-2006
# Posted on: 03-Oct-2012 17:22:36   

i was fetching a dynamiclist and fields were coming from different entities, so a custom property was not really an option.

i did use dbfunctioncall and it worked, thanks.

-shane

daelmo wrote:

Hi Shane,

Are you fetching a DynamicList or just doing that for filter purposes?

If you just want to concatenate two fields, Why don't do it in memory with a custom property?

public partial class Customer
{
     public string FullName
     {
          get {return string.Format("{0} {1}", this.FirstName, this.LastName); }
     }
}

If, for some reason you want to do it on the server, then yes, use a DBFunctionCall. Examples: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=16711&StartAtMessage=0&#93484 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=20410&StartAtMessage=0&#115077 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=20410&StartAtMessage=0&#115033