Retrieving columns in a typed view

Posts   
 
    
Ross
User
Posts: 8
Joined: 02-Jun-2004
# Posted on: 24-Jun-2004 18:02:07   

I'm retrieving a subset of columns from a typed view, however I want to change the order that I see the columns.

Ex.

The typed view returns columns A, B, C, D, E, F. I'm only interested in columns A, B, C (so I just get these columns), but I want to see them in the order of B, C, A.

Is this possible?

Here is a code sample that i'm using to do this:

Dim ssc As New SearchStakeholderCompanyTypedView Dim viewBucket As New RelationPredicateBucket Dim viewExpression As IPredicateExpression = New PredicateExpression Dim fields As EntityFields2 Dim selectedFields As New EntityFields2(3)

viewExpression.Add( CAAPS.Business.Common.Stakeholder.FactoryClasses.PredicateFactory.CompareValue( CAAPS.Business.Common.Stakeholder.SearchStakeholderCompanyFieldIndex.PartyID, ComparisonOperator.Equal, 104054)) viewBucket.PredicateExpression.Add(viewExpression)

fields = ssc.GetFieldsInfo()

selectedFields(0) = fields.Item("PartyType") selectedFields(1) = fields.Item("PartyID") selectedFields(2) = fields.Item("LegalName") dgDisplay2.DataSource = remoteObj.FetchTypedView(selectedFields, viewBucket, True)


In this case 'ssc' is a typed view that has quite a few columns, but the order of the first 3 columns PartyID, PartyType and LegalName.

I would like them returned back in the above order, instead all that happens is the column headers get changed but the data stays in the same order.

Original Data:

PartyID PartyType LegalName

1 type1 name1

After the code:

PartyType PartyID LegalName

1 type1 name1

Thanks. Ross.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 24-Jun-2004 18:04:34   

If this is for databinding, you could of course set this up in teh databound control, for example the grid.

Frans Bouma | Lead developer LLBLGen Pro
Marcus avatar
Marcus
User
Posts: 747
Joined: 23-Apr-2004
# Posted on: 28-Nov-2004 12:20:35   

Ross wrote:


fields = ssc.GetFieldsInfo()

selectedFields(0) = fields.Item("PartyType")
selectedFields(1) = fields.Item("PartyID")
selectedFields(2) = fields.Item("LegalName")
dgDisplay2.DataSource = remoteObj.FetchTypedView(selectedFields, viewBucket, True)

I've been looking for ways to do something like this... I want to retreive a subset of columns from a table which contains a lots of nText data.

Is this the most efficient method of selecting the fields? Is there a CreateField method somewhere?

Marcus

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 29-Nov-2004 09:23:41   

You could use ResultsetFields to create an EntityFields2 object easily, you can also use EntityFieldFactory.Create(..) simple_smile

Frans Bouma | Lead developer LLBLGen Pro