locked
How to add Order by expression on Link Entity attribute in Query Expression? RRS feed

  • Question

  • Hi,

    I need to add order by on link entity attribute in query expression. 

    My query in fetch xml format is as below-

    <fetch mapping='logical'>
    <entity name='policymember'>
    <all-attributes/>
    <filter type='and'>
    <condition attribute='memberid' operator='eq' value='8B7E5B4C-EE47-DE11-A167-0015177CD626'/>
    </filter>
    <link-entity name='policy' from='policyid' to='policynoid' alias='MemberPolicy' link-type='natural'>
    <filter type='and'>
    <condition attribute='enddate' operator='ge' value='09-18-2011'/>
    </filter>
    <order attribute='modifiedon' descending='true'/>
    </link-entity>
    </entity>
    </fetch>


    Thanks in Advance.

    Wednesday, September 18, 2013 10:51 AM

All replies

  • I think the query is correct however the date is not correct put date like

     <condition attribute='enddate' operator='ge' value='2011-09-18' />


    Regards Faisal

    Wednesday, September 18, 2013 11:07 AM
  • Hi,

    I agree with Faisal and Your Order expression is correct.

    Thanks!

    Hope this helps!

    If this post helps you, please click "Mark As Answer" on the post and "Vote as Helpful"

    Wednesday, September 18, 2013 11:33 AM
  • Thank you guys for your quick response. 

    The above fetch xml query is working absolutely fine but my requirement is i want the same query inQuery Expression format. I have written the query expression as well but unable to add order byon link entity attribute(i.e modifiedon) in that expression.

    Your valuable inputs are highly appreciated.

    Regards, Atul

    Thursday, September 19, 2013 5:14 AM
  • Hi,

    Order by clauses are not supported on link entities in query expressions.


    Michael Palmer
    xRMPalmer     @MJFPalmer     Rockstar365

    Thursday, September 19, 2013 6:39 AM
  • Hi,

    Yes, I agree with Michael. In Queryexpression On Link entities you can not use Order By Clause.

    Thanks!


    • Edited by Kalim Khan Thursday, September 19, 2013 10:38 AM
    • Proposed as answer by Kalim Khan Friday, September 20, 2013 5:39 PM
    Thursday, September 19, 2013 10:37 AM