For additional info,i created this variable FileList as an system.object as variableType,and called this variable below and got this error.
I am just a beginner and its my 6th day learning this RPA tool so can anyone please help?
And moreover i have to use for-Each loop only stead of for each row,here my main motive was to scrap the data from some pdf file and make a datatable at the end
Change the datatype of FileList from System.Object to String Array
then press ok, ok
But i have to read some pdf files,so will string array be applicable because i think to read pdf files/word document we need to take variabletype as Array of object.
Or if you can clarify this it would be grateful
the returned result of Directory.GetFiles … is a String Array
From official Docu:
This is independend of what files are present in the directory
Method GetFiles retuns an array of string
Therefore FileList should be of this type
I recommend you to watch the IntelliPrompts. It gives useful context related proposals
But who is reading documentation these days?
Just try attached sequence change the path in assign activity…
for_each_file_in_folder.xaml (9.7 KB)
Very cool that you are learning to get help here on the forum! Well, for each is an activity that runs through variables that are iterable! In this case, you created your FileList variable as Object and this variable is not Enumerable to be iterable. By default, the Directory.GetFiles method returns an Array of strings, where each element of this array is a String containing the file path. An array is an iterable variable in for each!
See that we can even work around the case. But it’s not a fancy way.
So you can change you variable to Array of String!
Lets check the output!
Any additional questions seek help here! Good luck on your RPA journey!
Shivam, the Read Pdf activity takes as input argument the path of the pdf file! The pdf file path is a string, so you can treat the pdf document as your own
own full path. The activity itself is in charge of opening this file with the desired extension and verifies if, in fact, it represents a .pdf file.
The error tells you why. Your variable is System.Collections.IEnumerable but you have the For Each set to Object.
Thank you all for helping me,
So i did some changes(was just doing experiment to the statement in the 1st assign activity ) and as soon as i removed (.toString) from Directory.Getfiles(“path”),it worked because what i was doing was,trying to assign this string to a 1-dimensional array of objects which is not possible with string
Thought to update you all coz you all were helping me.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.