Lpt EntityDefinition.Fields sorted always alphabetically

Posts   
 
    
raist
User
Posts: 114
Joined: 19-Apr-2010
# Posted on: 18-Apr-2012 17:26:14   

v3.5 March 30th, 2012 It happens with .Fields in EntityDefinion, TypedListDefinition and TypedViewDefinition objects, in spite of any Field Order set in the Designer for that class

// usage example
EntityDefinition currentEntity
foreach(var field in currentEntity.Fields)
{
   // always in alphabetical order. 
  // currentEntity.Fields.IsSorted is false
}

Is it a settings issue? It didn't happend with v.3.1

Regards,

Jose

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 18-Apr-2012 19:08:36   

Have you checked this: Field Ordering

raist
User
Posts: 114
Joined: 19-Apr-2010
# Posted on: 18-Apr-2012 20:21:27   

Ummm... That's what I'm trying to say. I have already set the field order in entity editor, but it's useless. I tried selfserving. I'll check the UseCustomField... & ResetFieldOrder... settings, but I'm pretty sure they have default values as I have tried on three different projects and +10 elements (entities, tview & tList) Weird? Regards, Jose confused

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Apr-2012 07:42:10   

Hi Jose. Try this:

return currentEntity.GetAllFieldsInElement(true, false);
David Elizondo | LLBLGen Support Team
raist
User
Posts: 114
Joined: 19-Apr-2010
# Posted on: 19-Apr-2012 10:01:28   

That's it!!!

// User defined or (default) alphabetical order
currentEntity.GetAllFieldsInElement(true, false); 

instead of

// Always alphabetical order
currentEntity.Fields; 

Thanks both for keeping up to your standards smile

raist
User
Posts: 114
Joined: 19-Apr-2010
# Posted on: 19-Apr-2012 13:41:12   

Updated & closed. To get the sorted list of fields, the right function calls are:

currentEntity.GetAllFieldsInElement(true, false); 
currentTypedView.GetAllFieldsInElement(true, false); 
currentTypedList.Fields;
// currentTypedList.GetAllPotentialTypedListFields()  gets them in alphabetical order

Regards,

Jose