This topic contains 6 replies, has 3 voices, and was last updated by  Eliot Muir 8 years, 11 months ago.

To File Channel (FTP upload) file names: Is there a way to include the original

  • Output File Mask and File Id allows me to create a file name and format the file using the timestamp but I would like to include the filename into the output file name.

    Is there a way to include the original file name into the output file name?

    Example:
    Input filename = Test.csv
    Output filename = Test201406261730_0000.csv

    Maybe I can use From Translator and To Translator but From File to File seems a lot more easier.

    Please note file name test is a variable. The file names that I need to use are: “Alerts”, “Alergies” and “Diagnosis” for the daily data extracts.

    No way. Use ‘To Translator if you need customized file name.

    Do you recommend; FROM FILE to TRANSLATOR or FROM TRANSLATOR to TRANSLATOR.

    I cannot push the data from Translator to Translator script in a single channel. I’m trying to get the file name from a folder and send that file to ftp. That should be straight forward but I cannot get the file name into the To Translator script from Translator.

    Please see attached for details

    Attachments:
    You must be logged in to view attached files.

    Just put all the info you need into a JSON object and push that into the queue.

    Something like:

    local T={}

    T.content = …
    T.name = FileName

    queue.push{data=json.serialize{data=T}}

    Hope that helps.

    Used queue.push{data=Filename} to push the file name From Translator and it works fine now.
    I used From Translator to Translator. To Translator gets the file name from From Translator and processes the file for FTP.

    function main ()
    local result = os.execute(“”)
    print (result)

    local root = ‘/home/kainos/Graphnet/’
    local file = ‘.csv’
    local Filename = findFile(root, file)

    if Filename then
    queue.push{data=Filename}
    end
    end

    findFile function gets the file name from a folder and returns the file name for the main()

    Thanks for your help.

    Looks like a good solution. Good job!

Tagged: 

You must be logged in to reply to this topic.