exclude fields from a typedlist

Posts   
 
    
riclo
User
Posts: 7
Joined: 13-Aug-2010
# Posted on: 28-Sep-2010 12:37:17   

Hello,

I saw that the ExcludeIncludeFieldsList option only works with entitycollection.

I would like to exclude fields from a typedlist. I am using a typedlist with fields from several tables (with a relation)

What would be the best way to do this.

I thought maybe this way:

capture the fields in an EntityFields2 array

allFields = tl.GetFieldsInfo();

and delete speficic rows, but the allfields.removeAt doesn't seem to be a valid

I also tried this:

start with an empty Enityfields2 array and add one by one

displayFields.Expand(1); displayFields.DefineField(allFields[index], displayFields.Count - 1);

the result is that almost all fields from the maintable is done nicely, but the fields from the related tables stays empty.

tableA.fieldA tableA.fieldB tableB.fieldA (stays empty) ...

Richard

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 28-Sep-2010 22:08:16   

I would either create 2 TypedLists, one with the fields excluded, and one included, or just build a DynamicList including the exact fields that you need - as these are largely similar it should be easy to do in one method with a paramter to control whether to include the unwanted fields.

Matt

riclo
User
Posts: 7
Joined: 13-Aug-2010
# Posted on: 29-Sep-2010 10:32:49   

Hi Matt,

The goal is to display all the possible fields from the typedlist and let the user makes his own selection. So you'll never know which fields is going to come in the result. So it would be a dynamic one. And that's what i was trying to do, but experienced the problem that some fields remains empty. As I mentioned i tried this approach:

One Enityfields2 array is filled with all fields form the typedlist by Typedlist.getfieldsfinfo() The second one is empty and filled with the fields selected by the user. in this way: displayFields.Expand(1); displayFields.DefineField(allFields[index], displayFields.Count - 1);

Fields from the maintable is filled nicely, but the fields of related tables stays empty

tableA.fieldA tableA.fieldB tableB.fieldA (stays empty)

MTrinder wrote:

I would either create 2 TypedLists, one with the fields excluded, and one included, or just build a DynamicList including the exact fields that you need - as these are largely similar it should be easy to do in one method with a paramter to control whether to include the unwanted fields.

Matt

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 29-Sep-2010 12:03:39   

The goal is to display all the possible fields from the typedlist and let the user makes his own selection. So you'll never know which fields is going to come in the result. So it would be a dynamic one.

That's perfectly why you should use a DynamicList.