Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> TypedList Calculated fields error
 

Pages: 1
Bugs & Issues
TypedList Calculated fields error
Page:1/1 

  Print all messages in this thread  
Poster Message
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 05-Jun-2013 17:34:30.  
v 4.0 May 15th, 2013
I have a TypedList with two calculated fields. Used to work properly in v.3.5
Should I change anything
Code:

public partial class VentasTotalesPorProductoTypedList
{
            // new column
        DataColumn _columnTotal;
        DataColumn _columnTotalDiscount;
        protected override void OnResultsetBuilt(IEntityFields fields)
        {
            // expand fields and define the new ones
            fields.Expand(2);
            fields.DefineField(new EntityField(
                "Total",
                OrderDetailFields.Quantity * OrderDetailFields.UnitPrice * (1 - OrderDetailFields.Discount),
                AggregateFunction.Sum,
                typeof(System.Decimal)
                ), fields.Count - 2);
            fields.DefineField(new EntityField(
                "TotalDiscount",
                OrderDetailFields.Quantity * OrderDetailFields.UnitPrice * OrderDetailFields.Discount,
                AggregateFunction.Sum,
                typeof(System.Decimal)
                ), fields.Count - 1);
            base.OnResultsetBuilt(fields);
        }
...
}

The field.Expand(2) line gives an error, because _fieldPersistenceInfos is null
SD.LLBLGen.Pro.ORMSupportClasses.EntityFields Expand method:
Code:
public override void Expand(int numberOfNewCells)
{
    base.Expand(numberOfNewCells);
    Array.Resize(ref _fieldPersistenceInfos, _fieldPersistenceInfos.Length + numberOfNewCells);
}


TIA
  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37797 posts
# Posted on: 05-Jun-2013 18:03:23.  
You use the latest runtime build? Or do you use the may 15th runtime build?

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 05-Jun-2013 18:27:25.  
Tried with lastest build (27th may) just downloaded.
Same error
  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14569 posts
# Posted on: 05-Jun-2013 19:08:56.  
Could you please post the exception text and stack trace?

  Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 06-Jun-2013 12:07:08.  
// System.NullReferenceException in EntityFields.Expand (_fieldPersistenceInfos == null)
Code:

// ASP.Net calling code:
Northwind.TypedListClasses.VentasTotalesPorProductoTypedList tl = new VentasTotalesPorProductoTypedList();
>tl.Fill(20, null);

// Calling code on VentasTotalesPorProductoTypedList.OnResultsetBuilt:
Línea 41:         {
Línea 42:             // expand fields and define the new ones
>Línea 43:             fields.Expand(2);
Línea 44:             fields.DefineField(new EntityField(
Línea 45:                 "Total",


Stack trace:
Code:

[NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.]
SD.LLBLGen.Pro.ORMSupportClasses.EntityFields.Expand(Int32 numberOfNewCells) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\EntityFields.cs:199
Northwind.TypedListClasses.VentasTotalesPorProductoTypedList.OnResultsetBuilt(IEntityFields fields) in D:\tmp\N23_Sort\ExtendedClasses\Extended_TypedList.cs:43
Northwind.TypedListClasses.VentasTotalesPorProductoTypedList.BuildResultset() in D:\tmp\N23_Sort\TypedListClasses\VentasTotalesPorProductoTypedList.cs:131
SD.LLBLGen.Pro.ORMSupportClasses.TypedListBase`1.Fill(Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, Boolean allowDuplicates, IPredicate selectFilter, ITransaction transactionToUse, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\TypedListBase.cs:173
SD.LLBLGen.Pro.ORMSupportClasses.TypedListBase`1.Fill(Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses) in c:\Myprojects\VS.NET Projects\LLBLGen Pro v4.0\Frameworks\LLBLGen Pro\RuntimeLibraries\ORMSupportClasses\SelfServicingSpecific\TypedListBase.cs:105
ListControl.GridLoaded(Object sender, EventArgs e) in D:\tmp\N23_Sort\GUI\BaseControls\ListControl.cs:199
  Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 06-Jun-2013 12:22:04. Goto attachments  
Attached Northwind project with the TypedList
All the new code (OnResultsetBuilt, etc. in ExtendedClasses dir)


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37797 posts
# Posted on: 06-Jun-2013 14:25:10.  
We'll look into it!
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37797 posts
# Posted on: 06-Jun-2013 14:55:59.  
Fixed in next build. Will be up in less than an hour.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
raist
User



Location:
Madrid, Spain
Joined on:
19-Apr-2010 23:57:10
Posted:
114 posts
# Posted on: 06-Jun-2013 17:53:16.  
Tested.
And once again... solved!!!

Thanks
  Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.