How do I loop thru a library and copy the same item for every value found in a multi value property field

  • 24 October 2016
  • 6 replies
  • 1 view

Badge +9

I have a Library called Intake with a property field called Assignee.  The column called Assignee allows multiple values.  I want to loop thru the library and copy an individual item from the Intake library to another document library called "Owners" (within the same site) for each value found in the Assignee column.

Thus if the Intake Library has 1 item and the Assignee field contains 2 values: Tom and Jerry.  Then I want to copy the same item twice from the Intake library to the Owners library.  I do realize in the Owners library that the Name will display a time stamp since the same file is being loaded multiple times.  In addition I will do a Set Value so the Owners item has the individual assignee's name.

Essentially my question is using my example how can I determine that I need to copy the item twice into the Owners library. I am somewhat familiar with Query ListFor Each, and Collections which I assume I need to use, but determining how to iterate on each value found for the Assignee field has me stumped ?


6 replies

Badge +10

Hi David,

You can use the query list and store the field value in single line text. Use collection operation to split (by semi-colon) and store that in a collection variable. Now use for each loop to iterate through the item. Depending on the no of iterations you can copy the item.

Badge +9

Hi,

I had a similar of multiple values when I used the repeating section(with 3 columns) in my form. Due to the repeating section I had multiple values for each of the column. Using this http://vadimtabakman.com/nintex-workflow-iterate-through-related-collections.aspx I iterated values and stored in variables and used the create item action to create item for each value.

Badge +9

Sojan...can you clarify your statement "Depending on the no of iterations you can copy the item."  Is there a limit on the copy items ?  I do not expect i would be copying more than 10 items from a single item in the Intake library. thx !

Badge +9

Also..I think you intended to indicate I should do a "Regular Expression" for the split ?

Badge +5

Hi David.

As Sojan suggested, you can use regular expression to split the Assignee field into mutiple values in that collection. Then use For each to iterate through those values. In each loop you can copy the document along with the assignee value to the target library.

I dont think there is currently a limit on the collection action. 

Badge +10

when you split the assignee, and store them in a collection variable. You can loop through the collection variable using foreach. If there are 2 assignee the collection variable will have 2 item. I dont think there is a limit for the item to copy.

Reply