Dynamic List: Error in my RelationCollection?

Posts   
 
    
BertS
User
Posts: 89
Joined: 28-Jul-2005
# Posted on: 15-Feb-2006 17:18:46   

Hi,

I have the following code, but this gives me (in the GetMulti...) a nullreference-exception. I think that the problem is in the RelactionCollection, but I'm not sure.

(Using v2004.2 with SelfServicing)


        Dim _purchaseInvoiceFields As New ResultsetFields(6)
        _purchaseInvoiceFields.DefineField(PurchaseInvoiceFieldIndex.Id, 0, "Id")
        _purchaseInvoiceFields.DefineField(CostTypeFieldIndex.Title, 1, "CostType")
        _purchaseInvoiceFields.DefineField(CompanyFieldIndex.Name1, 2, "Company")
        _purchaseInvoiceFields.DefineField(PurchaseInvoiceFieldIndex.BookingNo, 3, "BookingNo")
        _purchaseInvoiceFields.DefineField(PurchaseInvoiceRowFieldIndex.AmountEur, 4, "AmountPurchase")

        Dim _purchaseInvoiceRelations As New RelationCollection     ' Relations
        _purchaseInvoiceRelations.Add(PurchaseInvoiceEntity.Relations.CompanyEntityUsingSupplierId, JoinHint.Left)
        _purchaseInvoiceRelations.Add(PurchaseInvoiceEntity.Relations.PurchaseInvoiceRowEntityUsingPurchaseInvoiceId, JoinHint.Left)
        _purchaseInvoiceRelations.Add(PurchaseInvoiceRowEntity.Relations.CostEntityUsingCostId, JoinHint.Left)
        _purchaseInvoiceRelations.Add(CostEntity.Relations.CostTypeEntityUsingCostTypeId, JoinHint.Left)

        Dim _purchaseInvoiceSorter As New SortExpression         ' Sorting
        _purchaseInvoiceSorter.Add(SortClauseFactory.Create(PurchaseInvoiceFieldIndex.BookingNo, SortOperator.Ascending))

        Dim _purchaseInvoiceFilter As New PredicateExpression        ' Filter
        _purchaseInvoiceFilter.Add(PredicateFactory.CompareRange(PurchaseInvoiceRowFieldIndex.TransportOrderId, _orderIdRange))

        Dim _purchaseInvoiceTable As New DataTable       ' Fill list
        _dao.GetMultiAsDataTable(_purchaseInvoiceFields, _purchaseInvoiceTable, 0, _purchaseInvoiceSorter, _purchaseInvoiceFilter, _purchaseInvoiceRelations, False, Nothing, Nothing, 0, 0)

jeffreygg
User
Posts: 805
Joined: 26-Oct-2003
# Posted on: 15-Feb-2006 19:58:12   

You've created your resultset to hold 6 fields, but only define 5. simple_smile

Jeff...

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 15-Feb-2006 23:10:14   

Heh. Run into this one a few times myself. simple_smile

Any chance of a more intuitive error message on this in version 2?

Finishing up my project this week. The project I start next week is Java, so no LLBLGen for me for a while.

cry cry cry cry cry cry

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39930
Joined: 17-Aug-2003
# Posted on: 16-Feb-2006 09:27:17   

psandler wrote:

Heh. Run into this one a few times myself. simple_smile

Any chance of a more intuitive error message on this in version 2?

I'll look into adding a more appropriate error message. It indeed doesnt' check on a null value for field persistence info.

Frans Bouma | Lead developer LLBLGen Pro
BertS
User
Posts: 89
Joined: 28-Jul-2005
# Posted on: 16-Feb-2006 17:44:54   

jeffreygg wrote:

You've created your resultset to hold 6 fields, but only define 5. simple_smile

Jeff...

Ah thanx!

I was just focussing on the relations, because I'm new to dealing with relations at several levels, so I didn't check this sort of things simple_smile