简体   繁体   中英

SP 2010 Query CAML - How to sort by multivalue colum lookup field?

I'm trying to sort a list where a column is based on multiple value on a lookup field with the following statement:

<OrderBy>
  <FieldRef Name='LookupFieldName' Ascending='TRUE' LookupValue='TRUE' />
</OrderBy>

If I uncheck "Allow multiple values" from column settings it works fine, but not with multiple values enabled.

Have you some suggestions?

Why SP can't sort on concatenation of ID#Value (eg. 1#Value1;2#Value2) ?

Thanks

You should be able to treat the addtional columns as any other column. In this example, Attorney1_x003a_EmpID is one of the multiple values:

<Query>
    <OrderBy>
         <FieldRef Name="Attorney1" Ascending="False" />
         <FieldRef Name="Attorney1_x003a_EmpID" Ascending="False" />
    </OrderBy>
</Query>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM