Reputation: 65
i have a table named "table_1" which contains id, col_1, col_2, col_3. col_1 is the summary property, so, when i query "table_1" (by any filter), i get the query result summarized by the summary property "col_1".
I need to get the same result but summarized by "col_2" that isn't the summary property. Can anyone help me?
Here's my query code:
partial void table_1_PreprocessQuery(ref IQueryable<table_1Item> query)
{
query = (from item in query
select item.col_2).Execute().Distinct();
}
It doesn't work because it throw me an exception like this:
"Cannot implicitly convert type 'System.Linq.IQueryable in System.Linq.IQueryable"
col_2
is a string type. So i need that the query result type is System.Linq.IQueryable<table_1Item>
.
Upvotes: 1
Views: 158
Reputation: 3875
change
partial void table_1_PreprocessQuery(ref IQueryable<table_1Item> query)
{
query = (from item in query
select item.col_2).Execute().Distinct();
}
to
partial void table_1_PreprocessQuery(ref IQueryable<table_1Item> query)
{
query = (IQueryable<table_1Item>)(from item in query
select item.col_2).Execute().Distinct();
}
This will cast explicitly.
Upvotes: 1