New Posts New Posts RSS Feed: Query using Take
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Query using Take

 Post Reply Post Reply
Author
jtraband View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 19-Sep-2012
Posts: 55
Post Options Post Options   Quote jtraband Quote  Post ReplyReply Direct Link To This Post Topic: Query using Take
    Posted: 26-Oct-2012 at 5:41pm
Unfortunately no.  Expand will simply expand whatever the rest of the query returns

so

var query = new entityModel.EntityQuery()
                 .from("Customers")
                 .where("CustId", "==", "1")
                 .expand("Orders");

will give you cust: 1 and all of its orders; we do not yet have a good way to say "give me cust: 1 and just its first 500 orders.

What we have looked at, but is still in the research stage is the ability to do subqueries in projections, so that you could potentially, ( meaning not yet), do the following.

var query = new entityModel.EntityQuery()
                 .from("Customers")
                 .where("CustId", "==", "1")
                 .select("customerName, orders.take(500)");

Note that projections work today, but they cannot currently contain query clauses.

If this looks useful, please vote for this feature using the feedback mechanism on the web site. ( small icon on the right side of any Breeze website page labeled "Feedback").  This helps us decide which features to focus on next.

Back to Top
Orizz View Drop Down
Newbie
Newbie


Joined: 15-Oct-2012
Posts: 16
Post Options Post Options   Quote Orizz Quote  Post ReplyReply Direct Link To This Post Posted: 26-Oct-2012 at 4:28am
Hi there,

Working my way through Breeze and very impressed so far.

I was wondering if its possible to use a combination of Take / Expand in a query for example...

var query = new entityModel.EntityQuery()
                 .from("Customers").where("CustId", "==", "1").expand("Orders").take(500);

var query = new entityModel.EntityQuery()
                 .from("Customers").where("CustId", "==", "1").select().expand("Orders").take(500);

var query = new entityModel.EntityQuery()
                 .from("Customers").where("CustId", "==", "1").take(1).expand("Orders").take(500);

I've tried a combination of the above without any luck, I just want a top level Customer object and a list of limited Orders

Hope you can help!


Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down