Aggregates ans typed views

Posts   
 
    
JayBee
User
Posts: 275
Joined: 28-Dec-2006
# Posted on: 29-Oct-2015 23:33:42   

Hi,

Two questions:

  1. Is it possible to use a count aggregate for a types view? Is so, can you give an example?

  2. Is it possible to add a property to a typed view? E.g. if the value of a column in a column = 2 the property is "Blue", if it is 3 it should be "Green", etc...

Thanks for your help,

Jan

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Oct-2015 07:15:19   

JayBee wrote:

  1. Is it possible to use a count aggregate for a types view? Is so, can you give an example?

Hi Jan. Check this out: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8499&StartAtMessage=0&#47019

JayBee wrote:

  1. Is it possible to add a property to a typed view? E.g. if the value of a column in a column = 2 the property is "Blue", if it is 3 it should be "Green", etc...

As a TypedView is a DataTable, you should add a DataColumn on the OnInitialized method. Check this: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8913&StartAtMessage=0&#49399

David Elizondo | LLBLGen Support Team
JayBee
User
Posts: 275
Joined: 28-Dec-2006
# Posted on: 30-Oct-2015 17:42:46   

Hi Daelmo,

I've looked at the links you supplied. Mapping the view on an entity IMHO gives cleaner way to achieve what I want. Is there any reason I should not use entity classes / collections?

Or perhaps forget the view and try to use the query factory?

I would like to create the following query:

select Code, [Description], Count(*) As Nmbr from MyView where DateTimeCreated between '20140101' and '20141231' and Code > 0 group by Code, [Description] order by Code

The DateTime is a variable that depends on user input.

Best regards,

Jan

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 31-Oct-2015 03:54:50   

Indeed. In this case, that seems more convenient (Entity/Collections), you can easily do that query with a DynamicList using the EntityFields of the involved entity.

David Elizondo | LLBLGen Support Team