Unable to cast object of type 'system.char' to type 'system.string in Docu processing

Hi,

I ha
Invoice_2023.zip (140.9 KB)
ve the above error when develping the Document Processing. Appreciate if someone could help. Pls find attached file.
Thank you.

Regards,
AP.

@apeterg

I see filelist is of type string…I guess you need list of files which would be of type list(of string) or array of strings …can you please recheck on the same

And in the for loop you are trying to loop on filelist variables which is a string so each iteration will have a character and I guess you are trying to use type argument as string again…hence you are getting this error

Cheers

Hi,

Can you try to modify as the following?

First, change Varaible type of FileList to String array.
Then, remove ToString method from the first expression.

Regards,

Hi @apeterg,

Change data type of ‘FileList’ variable to “Array of String” and type argument of Foreach activity to String,
Then pass “item” to Document Path of each activity.

Hope this helps!

Hi Yoichi,

Thanks or your help, issue solved. But now another error appear about the path. But I am very sure that the absulote path is correct. ANything to do wth the variable type ?? I tried few types but still recive dthe same error.

Thanks.

Regards,
AP.

Try to hard code complete document path and pass it. See it works or not. If it works then variablize it

@apeterg

You have to pass the currentitem there which contains the file location…

You are currently pasing the folder location which is not a file.that firld expects a file to bw passwed

Cheers

1 Like

Hi,

I think you need to set item instead of DocFolder as the following.

image

Regards,

1 Like

@apeterg ’ docFolder’ variable contains folder path not file path,
Please pass file path.
You can Pass ‘item’ which contains file path.

1 Like

HI,

I tried this method, but didn’t work :

I am alraedy using a variable DocFolder in the “Document Path” activity.

Thanks.

Hi,

Sorry, if was my mistahe in the variable. Issue has been resolved. Appreciate everyone for the advice. Thank you.

Regards,
AP

3 Likes