New Posts New Posts RSS Feed: Union on EntityQueryPagedCollectionView
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Union on EntityQueryPagedCollectionView

 Post Reply Post Reply
Author
rowell_21 View Drop Down
Newbie
Newbie


Joined: 16-Mar-2011
Posts: 2
Post Options Post Options   Quote rowell_21 Quote  Post ReplyReply Direct Link To This Post Topic: Union on EntityQueryPagedCollectionView
    Posted: 16-Mar-2011 at 11:27pm
Is it possible to use union to add a new row on top of the results being queried?

I need to add something like "All Records" in the results and I'm using EntityQueryPagedCollectionView object and does not have a way to modify it before binding to a grid.

My results should look like this:

Id -  Name
0 -  All Records
1 -  Record1
2 -  Record2
3 -  Record3
...


I used to do it in stored procedure by having a union of the "All Records" row to the actual resort before returning it.


Thanks.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 22-Mar-2011 at 3:43pm
Hi rowell_21;

I'm not sure I follow your question. EntityQueryPagedCollectionView only works with an EntityQuery<T> and you can't access each individual row to modify the results.

Perhaps if you can elaborate your use case further, I can give you better suggestions.
Back to Top
rowell_21 View Drop Down
Newbie
Newbie


Joined: 16-Mar-2011
Posts: 2
Post Options Post Options   Quote rowell_21 Quote  Post ReplyReply Direct Link To This Post Posted: 24-Mar-2011 at 8:54am
Hi DenisK,

Thank you for your response.
Here's what I need to do:

I have one table named "Services" which has two columns, [ServiceId] int and [ServiceName] varchar.

I need to bind this to a grid but I need to have a row that has zero(0) for ServiceId and "All Services" for ServiceName.

I used to do this in stored procedure by a sample query below:

SELECT 0 AS [ServiceId], 'All Services' AS [ServiceName]
UNION
SELECT ServiceId, ServiceName FROM Services

this would result to:

ServiceId   ServiceName
0               All Services
1               Service1
2               Service2
3               Service3
.....


I would like to put a paging in my results to minimize traffic when loading all results.

Thanks.
Back to Top
DenisK View Drop Down
IdeaBlade
IdeaBlade


Joined: 25-Aug-2010
Posts: 715
Post Options Post Options   Quote DenisK Quote  Post ReplyReply Direct Link To This Post Posted: 24-Mar-2011 at 5:19pm
Hi rowell_21;

Unfortunately what you're asking won't work using EntityQueryPagedCollectionView. I only have 2 suggestions at this time.

1. Try using a different type of grid.

2. Don't use Union and instead store that record in the database.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down