KAPOW

Would you like to react to this message? Create an account in a few clicks or log in to continue.
KAPOW

Welcome to the Kapow forum. Here you can get help, use your skills to help others and enjoy hanging out in the company of other Kapow Robot Developers.


2 posters

    Saving Filename to a variable

    avatar
    kamaelxiii


    Posts : 6
    Points : 1770
    Join date : 2019-07-11

    Saving Filename to a variable Empty Saving Filename to a variable

    Post by kamaelxiii Wed Sep 11, 2019 3:42 pm

    I have a bot that reads excel file from a dump directory. I'd like to know if how I can retrieve the filename of a file and save it to a variable so that when I write the result file the original file name would be there.

    Sample:
    Original File name: CompanyABC.xslx
    Output File: CompanyABC-Processed-2019-9-11.xslx
    batman
    batman


    Posts : 47
    Points : 1923
    Join date : 2019-03-19

    Saving Filename to a variable Empty Re: Saving Filename to a variable

    Post by batman Wed Sep 11, 2019 7:03 pm

    Have a look at the For Each File action (found under Actions -> Loop), this is typically the action used for iterating through files in a directory.
    Each time a file is found the loop action allows you to assign the current file name to a text variable. This gives you the file name including the directory path.

    You can then manipulate your file name variable using an Assign Variable action.
    In this action, you can use expressions and converters in the value field to manipulate the filename to give you what you need.

      Current date/time is Sun Apr 28, 2024 4:07 pm