cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
wilkies0106aw
Nintex Newbie

Query and filter list if criteria is included in colletion output

All,

On a SharePoint list you can filter a list by multiple of a particular field i.e. user names.

I can get the user names into a collection based on a certain criteria - Happy Days.

Yet I don't know how to query the list and filter the results if the output is included in the collection. 

There seems to be no 'contains' option when it comes to query/filtering a list.

I assume it would have to include a For Each in someway shape or form - yet I'm going around in circles.

Thanks

Andrew

Labels: (1)
0 Kudos
Reply
3 Replies
lakshminarayana
Nintex Newbie

Re: Query and filter list if criteria is included in colletion output

You can use 'Run if' action inside a 'For each' to filter the collection output.

0 Kudos
Reply
wilkies0106aw
Nintex Newbie

Re: Query and filter list if criteria is included in colletion output

Does that mean then in each Run if action I have to manually input the value to check against? I was hoping to avoid that.

0 Kudos
Reply
Automation Master
Automation Master

Re: Query and filter list if criteria is included in colletion output

you do not need a loop. CAML support <In /> operator which you can feed with values to filter by.

see reference - In Element (Query) 

it's not directly clickable with query list's query builder, so you have to build the CAML query on your own.

first you need to convert collection of users into CAML's <Values /> elements.

this can be simply done with build string action

for better reading the formula is

{TextStart}<Value Type='User'>{TextEnd}
fn-Replace({TextStart}{WorkflowVariable:Coll_Users}{TextEnd},
           {TextStart};{TextEnd},
           {TextStart}</Value><Value Type='User'>{TextEnd})
{TextStart}</Value>{TextEnd}‍‍‍‍‍

then this output can be simply used in Query list action

<Query>
  <Lists>
    <List ID="{8BF2B7A1-A3BE-44D7-940C-FBF9EE867555}" />
  </Lists>
  <ViewFields>
    <FieldRef Name="ID" />
  </ViewFields>
  <Where>
     <In>
         <FieldRef Name='singlepp' />
         <Values>
                 {WorkflowVariable:ValuesList}
        </Values>
      </In>
   </Where>
</Query>






‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Note: this was tested with person field setting 'Show field' configured to 'Account' so users in a collection have to following that format and so have to be in format claim|domain\loginname

Reply