New Posts New Posts RSS Feed: More querying questions!
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

More querying questions!

 Post Reply Post Reply
Author
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 Topic: More querying questions!
    Posted: 29-Oct-2012 at 2:27pm
That's correct, 

I think the subqueries in projections would be a great addition for Breeze, I've come up a few situations where this would have aided the solution gracefully, I understand it's about prioritising features and producing this functionality in the right way though - so look forward to it!

Many thanks
Back to Top
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 Posted: 29-Oct-2012 at 2:18pm
Ok, I think I understand.  Do you mean that the problem is that this query
   from("Orders").where("Completed", "eq", true).expand("Customer");
does not return any "customer" entities when there are no "completed" orders? and presumably you want these customers as well.

If so, then I agree the only current approach is to perform the two queries.
   from("Customers")
followed by
   from("Orders").where("Completed", "eq", true);

The second query will automatically link the "orders" returned with the appropriate customers.

We have discussed, meaning this does not yet work, expressing this with a subquery within a projection query that might look something like this:
  from("Customers").select('this, orders.where("Completed", "eq", true)'
but we do not yet support subqueries in projections.

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: 29-Oct-2012 at 9:46am
If it is not possible, is there a recommended workaround?

If I select completed orders and expand customers (so the inverse) The json is parsed in such a way that it doesn't really increase the payload too much (using $ref), but obviously if there are no completed orders, the customer can't be returned!

The only way I can see around it is to do 2 calls to the web api, one to get the customer object and one to get the completed orders for that customer, I guess this all relates to sub queries in some way

Anyway a recommended workaround solution would be a great help!

Thanks


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: 29-Oct-2012 at 5:59am
Hi there,

Is the following possible?

I have a Customer object which is queried and includes an expand to get all the orders too. 

.from("Customer").expand("Orders");

I want to be able to only bring back orders which has been completed. 

So select the top level customer expand the orders so I get an Customer object with a List of orders and finally a list of orders which have been completed.

How do I get to the Completed property of the navigation object?

Many thanks!
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down