Using projections with AureliusDataset

Hi Wagner,

I want to limit the number of fields in an dataset connected to a grid but why does the grid just show one column 'Count'?


Manager.Find< TlaArea >
  .Select( TProjections.ProjectionList
     .Add( Linq[ 'Id' ] )
     .Add( Linq[ 'Description' ] )
             )
     .Where( Linq[ 'Description' ].lower.Contains( AFilter.ToLower ) );


The generated sql appears to be correct


SELECT A.ID As f0_, A.LA_AREA As f1_
FROM LA_AREAS A
WHERE  lower(A.LA_AREA) LIKE :p_0
                            
p_0 = "%%" (ftString)


I'm passing the criteria to the grid using SetSourceCriteria.

Regards

Steve

Hi Steve,

When using TList<TCriteriaResult> (projections) in the database, it's a must that you create the persistent fields first in the database. 

I'm having the same issue.  


Since the projections can include field names via .As_, why isn't the TAureliusDataset "smart enough" to pick up the field definitions from the projections, especially since I can use "FieldByName(fieldname)" on the ListValues, etc.?

TAureliusDataset creates default fields based on the "base class". It infers the base class from the TCriteria object associated to it, or from the list type for example (TList<TSomeClass>). It can't do that For TCriteriaResult objects, because it can't tell what the properties are there until the object is present in the list.