sorting - How to write XPath code to customize a sorted list of data in SharePoint Designer 2010? -
hello , thank help!
i working within data form web part in sharepoint designer , need sort data in abstract way. needs sorted 1 column alphabetically catch there 2 specific values column have absolute priority , belong @ top of list. brand new xpath language. can hand xpath code or direction take solve problem?
-philip
using xpath sort results in custom manner after server has delivered them not going efficient; it's better have sharepoint sort results via caml query parameters before returns them can work paged results. otherwise you'll looking @ retrieving every item list put them in right order.
you might consider taking different approach spares writing custom xslt. depending on column type drives sort order, may able add calculated column list displays modified version of source column's value.
the following formula checks if column named "source column" equal "value a" or "value b". if it's 1 of values, it'll display value preceded "1. " or "2. "; otherwise it'll display value preceded "3. ".
=if([source column]="value a","1. "&[source column],if([source column="value b","2. "&[source column],"3. "&[source column]))
here's quick matrix of calculated column's value various inputs:
source column | calculated value "value a" | "1. value a" "value b" | "2. value b" "value c" | "3. value c" "other value" | "3. other value"
the goal here not display value of calculated column, sort view it.
the end result items [source column] equal "value a" or "value b" on top, while rest of items sorted in alphabetical order.
Comments
Post a Comment