Answered by:
Master-Details for first record in details

Question
-
Hi everyone,
I have the following tables:
And this:
My question:
If I want to create a query that contains all the customers, but each customer should has only the last inserted order not all his orders.
So, how can I do that?
I want that query to print all the customers and only the last order for each customer.
I'll appreciate the help.
Best,
_________________
IT_Technician
Sunday, August 5, 2012 9:45 AM
Answers
-
Hi Yann,
Thanks for your reply.
I'm a newbee in Lightswitch, so can you guide step by step to do that.
Hi lionwin8,
Thanks for your reply.
But, can you explain it in more details? and don't forget I only want the first row of the orders for each customer.
I'll appreciate the help.
Best,
________________
IT_Technician
see:
Shape Your LightSwitch OData Using WCF RIA Services
and:
http://lightswitchhelpwebsite.com/Blog/tabid/61/tagid/21/WCF-RIA-Service.aspx
- Proposed as answer by Yann DuranModerator Wednesday, August 8, 2012 7:11 AM
- Marked as answer by Dino HeModerator Thursday, August 16, 2012 5:44 AM
Tuesday, August 7, 2012 8:21 PM
All replies
-
Guys, any idea?
Best,
________________
IT_Technician
Sunday, August 5, 2012 11:53 AM -
this can be done by using WCF RIA Services
- Edited by lionwin8 Sunday, August 5, 2012 8:41 PM
Sunday, August 5, 2012 8:37 PM -
Thank you lionwin8 for the reply.
But unfortunately, I don't have any idea about WCF RIA!
So, please can you explain to me the method that I should use to do what I need?
I prefer it to be step by step :)
Any other ideas?
I'll appreciate the help.
Best,
_________________
IT_Technician
Monday, August 6, 2012 5:16 AM -
No one can answer me!
Please, I'm really need the solution. I've postponed my deployment more than 3 days only for that issue, because I've tried all the possible queries to do that but I've had no result.
I'll really appreciate your help.
Best,
_________________
IT_Technician
Monday, August 6, 2012 10:34 AM -
Hi everyone,
The problem that I'm facing it is the following:
"You cannot convert LightSwitch.ApplicationData.Order to LightSwitch.IE......."
So, Yann or Justin don't you have any idea about that?
I'm really need the query that should filter the customers.
I want to print all the customers with the last inserted order for each one.
I'll appreciate the help.
Best,
___________________
IT_Technician
Tuesday, August 7, 2012 6:08 AM -
The problem is that you can only bind a data grid to an "entity", & the only way that you can create an entity that's a combination of two entities Which is what you're trying to do), is to do it in a RIA service. Then you can create a new entity of whatever "shape" you want.
Yann - LightSwitch Central - Click here for FREE Themes, Controls, Types and Commands If you find a reply helpful, please click "Vote as Helpful", if a reply answers your question, please click "Mark as Answer" By doing this you'll help people find answers faster. Tuesday, August 7, 2012 8:54 AMModerator -
we can make a query to sort the table by the date with the adding of a parameter to costumer Id ... then select first of default..
then bind the data grid to the master costumer fields.
but this will make it like a master details form not in one table.
----------------------------------- If My replay is helpful Please vote
Tuesday, August 7, 2012 9:42 AM -
Hi Yann,
Thanks for your reply.
I'm a newbee in Lightswitch, so can you guide step by step to do that.
Hi lionwin8,
Thanks for your reply.
But, can you explain it in more details? and don't forget I only want the first row of the orders for each customer.
I'll appreciate the help.
Best,
________________
IT_Technician
Tuesday, August 7, 2012 11:00 AM -
I try to mahe the filter on the server side if give me erorr..
So you can make a screen for the master then add the detail table from (add data table as query)
make to parameter for that query and link them to 2 property
then you can define the property in the selection change like in the code below
Private Sub costmerSet_SelectionChanged() queryadd() End Sub Private Sub costmerSet_Loaded(succeeded As Boolean) queryadd() End Sub Private Sub queryadd() Property1 = costmerSet.SelectedItem.Id Dim asd = Me.DataWorkspace.ApplicationData.Orders Dim asdq = asd.Where(Function(b) b.costmer.Id = costmerSet.SelectedItem.Id).OrderByDescending(Function(cw) cw.Orderdate).FirstOrDefault Property2 = asdq.Orderdate End Sub
----------------------------------- If My replay is helpful Please vote
- Edited by lionwin8 Tuesday, August 7, 2012 7:01 PM
Tuesday, August 7, 2012 6:59 PM -
Hi Yann,
Thanks for your reply.
I'm a newbee in Lightswitch, so can you guide step by step to do that.
Hi lionwin8,
Thanks for your reply.
But, can you explain it in more details? and don't forget I only want the first row of the orders for each customer.
I'll appreciate the help.
Best,
________________
IT_Technician
see:
Shape Your LightSwitch OData Using WCF RIA Services
and:
http://lightswitchhelpwebsite.com/Blog/tabid/61/tagid/21/WCF-RIA-Service.aspx
- Proposed as answer by Yann DuranModerator Wednesday, August 8, 2012 7:11 AM
- Marked as answer by Dino HeModerator Thursday, August 16, 2012 5:44 AM
Tuesday, August 7, 2012 8:21 PM -
Hi lionwin8,
Thanks for your reply. I'll try what you said today and give you a reply about it if it's work.
Hi ADefwebserver,
Thanks for guiding me through WCF RIA.
Best,
______________
IT_Technician
Wednesday, August 8, 2012 9:07 AM -
Hi everyone,
Please, can you check this thread:
I'll appreciate your help.
Best,
___________________
Thursday, August 23, 2012 6:28 AM