none
How to group the records RRS feed

  • Question

  •  Hi

     i have the following structure as below

    client  patientid  url

    1           AA1        http:\\test1

    1           AA1        http:\\test2

    and need to group the record in following heirachy

      client 

      patient

      list of urls


    • Edited by Sudhesh.G Tuesday, October 28, 2014 6:26 AM
    Tuesday, October 28, 2014 6:22 AM

Answers

  • Hello Sudhesh.G,

    >>and need to group the record in following heirachy

    Is that you want to do the group operation by LINQ? If it is, you could check the demo code below:

    var result = (from od in db.OrderDetails
    
                                  group new { od.OrderDetailID, od.OrderDetailName, od.OrderID } by new { od.OrderID, od.OrderDetailName } into god
    
                                  select new { OrderID = god.Key.OrderID, OrderDeatilName = god.Key.OrderDetailName, OrderDetailIDs = god.Select(g => g.OrderDetailID) }).ToList();
    

    You could replace the OrderID with client  , OrderDetailName with patientid  and OrderDetailID with url.

    Regards,

    Fred.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, October 29, 2014 1:44 AM
    Moderator