What have I done wrong? I am placing two variables together and writing to a CSV

I am attempting to pull two variables and combine them into one then write that information to a CSV. In this case file name and owner
Errors:
Cannot assign from type ‘System.String’ to type ‘System.String’ in Assign activity ‘Assign’.
Compiler error(s) encountered processing expression “FileList”.
‘FileList’ is not declared. It may be inaccessible due to its protection level.

Is there an easier way to do this?

image

@covcreo

  1. Your variable is called “fileslist” (with an s) but then you type “FileList” (without the s) in the For Each.
  2. fileslist shows it is a String. It needs to be an array of strings. Click the dropdown, choose “Array of <T>” and then select String.

i am half blind. that did clear up that error but gave me another. Now I get and error attempting to combine the strings

“string.concat(owner,filename)”

Cannot assign from type ‘System.String’ to type ‘System.String’ in Assign activity ‘Assign’.

@covcreo
String.Concat returns a string, not an array.

If you have fileA.txt and fileB.txt then String.Concat would return “fileA.txtfileB.txt”. You could instead separate them with a comma or semicolon and then use Split to return an array.

Ex:
files = String.Concat(fileA,";",fileB)
files.Split(";".ToCharArray)