LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  incrementing filename

    Employee
    Posted 11-21-2014 02:23

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: dhrobertson

    hi all,

    hopefully a quick one... I have a graph which outputs to an excel spreadsheet. each time I run the graph it will overwrite that spreadsheet as the name is hardcoded into the filename path on the output tab. I was wondering whether there is a way to use a timestamp function in order to make each saving of the excel file turn into a new file rather than overwriting the original each time....
    ie. instead of hardcoding c:\excelspreadsheet.xlsx on the output tab , it would be nice to be able to do something like c:\"excelspreadsheet" + timestamp() + ".xlsx" or something to that effect? is there a way to do this in the excel output node or any node for that matter than outputs to a different format?

    thanks

    douglas


  • 2.  RE: incrementing filename

    Employee
    Posted 11-21-2014 07:59

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    Write the spreadsheet into the desired folder, but name it something like temp.xls

    Then use a FILTER node to change the filename.

    movefile( "c:\temp.xlsx" , "c:\excelspreadsheet" + timestamp() + ".xlsx" )

    You will need to send one record into the FILTER node to get it to execute.. you can use a StaticData node or a Dummy Input node to build the one record you need.


  • 3.  RE: incrementing filename

    Employee
    Posted 11-21-2014 08:18

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: ejones

    I usually have to do what Stony said. But there are some occasions when an easier option is available. You may be able to se either a parameter you've declared, like {{^RunDate^}} or one that already exists like {{^CurrentDate^}} in the filename. But watch out that when automating a graph, the CurrentDate gets converted to the date you created the LXA or BRX file and not the current date. So if automating, you may be left with what Stony describes.

    When graphs run automatically, having a RunDate parameter that identifies the date range for the data being reported can make sense. Then putting that value on the filename can work nicely. It all depends on context.