none
CAML Query for display Top n records in sharepoint 2010

    Question

  • Hi friends,

    I have added the Content Query web part in my publishing page for displaying data from list.

    Now i want to use additional filter option from content query web part.

    pls tell me wht query i should write for returning Top n Records from list.

    also pls tell me whole caml query format dat i need to put in custom value or query option in additional filter option in Content Query Web Part

    Friday, November 26, 2010 9:59 AM

Answers

  • I don't see how to achieve this easily with Content by Query web part...

    You could do some advanced XSLT to hide item 1 and 2 and limit the number of results to 3 but it's not trivial or pleasant.

    Why not simply doing a custom sandbox web part?


    Florin DUCA - MCSE 2003 +Sec,MCTS conf/dev WSS3/MOSS, MCITP/MCPD SP 2010, MCPD ASP.Net 3.5, MCTS ISA 2006 - Logica Business Consulting, France
    • Marked as answer by Wayne Fan Thursday, December 02, 2010 3:16 AM
    Friday, November 26, 2010 10:54 AM

All replies

  • Why not simply use the limit the number of results to (in the edit panel for the Content By Query web part)
    Florin DUCA - MCSE 2003 +Sec,MCTS conf/dev WSS3/MOSS, MCITP/MCPD SP 2010, MCPD ASP.Net 3.5, MCTS ISA 2006 - Logica Business Consulting, France
    Friday, November 26, 2010 10:13 AM
  • Hi, thanx for quick reply

    I could be use this limit option but  I am filtering data that is filter from my Top 3 rd record.

    please let me know the query that return a date which is 3rd highest.

    so that i can filter date which is less than date which is 3rd highest.

    Friday, November 26, 2010 10:19 AM
  • I don't think this is possible (if I understant correctly what you are trying to achieve): you don't want to limit to top 3 list items but in fact you want to limit to top 3 dates (so if you have 100 items with the same date which is the highest you would have 100+ results).

    The only way possible to achieve this, in my opinion, is writing a custom web part ...


    Florin DUCA - MCSE 2003 +Sec,MCTS conf/dev WSS3/MOSS, MCITP/MCPD SP 2010, MCPD ASP.Net 3.5, MCTS ISA 2006 - Logica Business Consulting, France
    Friday, November 26, 2010 10:42 AM
  • No I think you are misunderstanding my questions

    shortly i m clearing my questions

    I want to retrieve 3rd top date. how can i acheive this?

    Friday, November 26, 2010 10:46 AM
  • I don't see how to achieve this easily with Content by Query web part...

    You could do some advanced XSLT to hide item 1 and 2 and limit the number of results to 3 but it's not trivial or pleasant.

    Why not simply doing a custom sandbox web part?


    Florin DUCA - MCSE 2003 +Sec,MCTS conf/dev WSS3/MOSS, MCITP/MCPD SP 2010, MCPD ASP.Net 3.5, MCTS ISA 2006 - Logica Business Consulting, France
    • Marked as answer by Wayne Fan Thursday, December 02, 2010 3:16 AM
    Friday, November 26, 2010 10:54 AM