TypedList - How to filter on aggregate Count?

Posts   
 
    
aliem
User
Posts: 21
Joined: 03-Oct-2006
# Posted on: 22-Feb-2007 21:59:11   

I created a typed list with three fields as follows:


fields.DefineField(KeywordFields.Keyword, 0);
fields.DefineField(KeywordFields.KeywordId, 1);
fields.DefineField(ListingKeywordFields.KeywordId, 2, "Count",   AggregateFunction.Count);

In short, I am calling all keywords used and their "Count" and this works fine. But I want to filter on the Count such that I only retrieve records with Count > than a certain value:

bucket.PredicateExpression.AddWithAnd(((EntityField2)fields["Count"]) > 1000);

The above does not work... but the simple filters on the basic fields like below work:

bucket.PredicateExpression.AddWithAnd(KeywordFields.KeywordId == "1");

any ideas? Also how would I perform filters like "SELECT TOP 10"?

Thanks

aliem
User
Posts: 21
Joined: 03-Oct-2006
# Posted on: 22-Feb-2007 23:29:38   

just to add to this. My guess is that the comparison is not doing arithmetic comparing but string comparison? I remember having the same problem while performing aggregating filtering with basic .NET datagrids, where I had to define the column types appropriately....

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 23-Feb-2007 06:04:35   

For the top 10 try this adapter.FetchTypedList(orderCustomer.GetFieldsInfo(), orderCustomer, bucket, 10, sorter, false);

something along those lines where the 4th parameter is a number other than 0. Can you enable tracing and show the sql that is being generated for your code?

aliem
User
Posts: 21
Joined: 03-Oct-2006
# Posted on: 23-Feb-2007 18:08:16   

Oh right I forgot about the parameter.

How do I enable tracing to output the SQL?

smurrell
User
Posts: 59
Joined: 22-Feb-2007
# Posted on: 23-Feb-2007 18:32:27   

aliem wrote:

Oh right I forgot about the parameter.

How do I enable tracing to output the SQL?

Add

<system.diagnostics> <switches> <add name="SqlServerDQE" value="4" /> </switches> </system.diagnostics>

to the <configuration> tag in your app.config file. This will dump every SQL command to either Visual Studio if you are still debugging your application. You can also download Debug View from SysInternals should be be running the actual release application. Debug View will capture the OutputString info which LLBLGEN is dumping.

You can use the other following names in your tag to capture outputs from other databases.

DQE / database Trace switch SqlServer SqlServerDQE MS Access AccessDQE Oracle (ODP.NET/Microsoft Oracle Provider) OracleDQE Firebird FirebirdDQE MySQL MySqlDQE IBM DB2 DB2DQE PostgreSql PostgreSqlDQE

Regards, Simon