List in Config File to be used in If statement


#1

Hi Gurus
I have a config file item as below
Company {“134”,145",“193”}

I have use this config item inside a loop and compare with row item FileString

if condition = Company.Contains(FileString(0))

How can i bring the values of Company inside the loop ? When i try to use Add to collection with Company as input its not working


#2

Hello.

I am understanding that you want to add the row item to the collection?
I’m assuming Company is an Array or List, which won’t work as Collections. And, arrays have a fixed length, but one method would be to recreate the array with the added item. (ie (String.Join(",",Company)+","+FileString(0).ToString).Split(","c) … so it joins the array, concatenates the new item, then splits it back to an array)

However, I actually would recommend using a Collection. You can do this by using the Build Collection activity, and then when you want to add to it, use Add to Collection.
It would look like this:
image

Where you place the Company list into the Collection property of the Build Collection activity, then use a Collection variable type in the Result property. Lastly, just place the row item into the Item property of the Add to Collection, and adjust the Type property accordingly.

EDIT: place the Add to Collection inside the Loop, while the Build happens at the beginning.

Regards.