Skip to main content
Question

Convert a string variable to a file variable


Forum|alt.badge.img+1

If I have a file path contained in a string variable. How can i convert this file path to a file variable which is selecting the same file. 

The use case is that I am trying to use the PDF actions and for these you have to pass in a “file” variable rather than a file path. In my process the PDF file will be created by the bot in an earlier step but i am only getting the file path as a string at that point. My question is how can i set this file path into a file type variable. 

4 replies

Padmakumar
Forum|alt.badge.img+13
  • Navigator | Tier 3
  • 785 replies
  • March 10, 2023

Hi @ibtasaam ,

 

Below is the supported inline conversion of a String type variable. If I am not mistaken, you can try with the File → Assign action for this. Else, there could be a chance for the same by using any line scripts like Python or JS.

 


Forum|alt.badge.img+6
  • Navigator | Tier 3
  • 142 replies
  • March 10, 2023

@ibtasaam Use File: Assign

 

 


Forum|alt.badge.img

In a nutshell, we cannot convert from string to file variable?

Its common process that the program open the some files using variable.

 


Forum|alt.badge.img+3
  • Navigator | Tier 3
  • 13 replies
  • July 31, 2024

I don’t know if @ibtasaam ‘s original post was fully answered. I, too, had this same issue with sending email attachments. The updated Email package wants a list of type File for the email attachments. I have a list of file names (string), but they are not File objects. The below image illustrates what I needed to do.

  • Acquire a list of file names from the target folder.
  • Loop over that list file name strings
    • Use a variable of type File and use File:Assign to put that file name string
    • Add the file variable to a list of type file (ListOfCompletedFiles)
  • After the loop completes, send that list of type File to the Email package.

Hopefully this provide a full illustration of the process


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings