I'm creating a list view - programatically in XML. The title field contains year only (list is some kind of yearly report). As I learned that it is not so easy to filter this in CAML in <Where>
,
I would like to be able to display only 3 items with highest year.
Can I use <RowLimit>
, or something similar in my ListDefinition's <View>
section? Coupled with <OrderBy>
, this would do the trick.
<Query>
<OrderBy>
<FieldRef Name='Title' Ascending='False' />
</OrderBy>
<Query>
A view schema should look like below and you can change the 3 inside, Paged="FALSE" means "row limit is absolute and there is no link to see more items"
Reference: http://msdn.microsoft.com/en-us/library/dd588460(v=office.11).aspx
<RowLimit Paged="FALSE">3</RowLimit>
<View BaseViewID="0" Type="HTML" MobileView="TRUE" TabularView="FALSE">
<Toolbar Type="Standard" />
<XslLink Default="TRUE">main.xsl</XslLink>
<RowLimit Paged="TRUE">3</RowLimit>
<ViewFields>
<FieldRef Name="LinkTitleNoMenu"></FieldRef>
</ViewFields>
<Query>
<OrderBy>
<FieldRef Name="Title" Ascending="False"></FieldRef>
</OrderBy>
</Query>
</View>