davidjohnson500
Nintex Newbie

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

Jump to solution

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 ?

0 Kudos
Reply
6 Replies
sojanm
Workflow Veteran

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

Jump to solution

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.

View solution in original post

Reply
achilles_aditya
Nintex Newbie

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

Jump to solution

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.

Reply
davidjohnson500
Nintex Newbie

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

Jump to solution

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 !

Reply
davidjohnson500
Nintex Newbie

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

Jump to solution

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

Reply
thomas_xu
Cloud Wanderer

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

Jump to solution

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. 

Reply
sojanm
Workflow Veteran

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

Jump to solution

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.

0 Kudos
Reply