Field from name

Posts   
 
    
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 24-Mar-2007 22:32:48   

Hi,

Can I get the following..

CustomerFields.Country

if I only have the string 'Country'?

Cheers, Ian.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 25-Mar-2007 05:14:32   

Hi Ian. What about something like this:

// create the specific enum you are looking for
CustomersFieldIndex fieldEnum = (CustomersFieldIndex) Enum.Parse(typeof(CustomersFieldIndex), "CustomerId");

// possible uses: create a field to use in a filter
EntityField2 field = (EntityField2) EntityFieldFactory.Create(fieldEnum);

// use in a filter
IRelationPredicateBucket filter = new RelationPredicateBucket();
filter.PredicateExpression.Add(field == "ALFKI");
David Elizondo | LLBLGen Support Team
Ian avatar
Ian
User
Posts: 511
Joined: 01-Apr-2005
# Posted on: 25-Mar-2007 15:01:23   

Thankyou.