Add To Collection: The property 'Collection' of 'Add To Collection' is not initialized

Hi,

My ‘Add collection’ activity returns this error message:

How can I resolve this? This is my second Add collection activity in my sequence does this affect it?

1 Like

So do I need to add new to ‘item.ToString’ in the assign activity?

you need to initialize the collection before using it

Have I not done that by doing the ‘assign’ activity?

Above add to collection use assign activity
Matchvalue2=New System.Collections.Generic.List(of String)

Is this true even for ‘System.Collections.Generic.ICollection<System.String’ variable? Including the assign activity for MatchValue2 works but only gives me the last item in the For Eeach loop

you need to add another foreach loop after add to collection

image

Addtocollection.xaml (8.2 KB)

@Katie_Vooght

You have to keep in mind following things.

  1. Initialize your collection.
  2. Add item to your collection and provide type of arguments you are adding.
  3. To get each item in collection, use for each and provide arguments type.

PFB SS for better understanding .

Hope this helps.

5 Likes

Thanks Lakshay that was clear and helpful

1 Like

hello katie , in the variables panel you should initialize the list by setting default to “New List(Of String)” so you can be able to assign value to it on the assign activity.
tell me if it worked