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.  Adding time stamp to output

    Employee
    Posted 01-13-2014 02:49

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

    Originally posted by: dialpemo

    Hiya,
    I am currently working on graph and the raph has to produce a daily output with the same name but I want that the output file includes the timestamp in order to avoid overriting the previous file


  • 2.  RE: Adding time stamp to output

    Employee
    Posted 01-13-2014 10:28

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

    Originally posted by: ejones

    You can use the BrainScript moveFile() function to rename a file after it is created to have the name you desire. So first you would create the file, then have a Filter node clocked to it that renames the file with the timestamp after the file is created. Attached is an example graph that does this.
    Attachments:
    ExampleFileRename.brg


  • 3.  RE: Adding time stamp to output

    Employee
    Posted 01-13-2014 15:12

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

    Originally posted by: DanRosenblatt

    Also- if you are running this graph in an automated manner, via a BRX, then you can pass arguments to the BRX to execute and have these substituted into parameter values.

    For example, in the script to execute the BRX, you can include an export line with 'p_' preceding the name of the parameter:

    #!/bin/bash
    .
    .
    export p_RunDate=`date '+%Y%m%d'`
    .
    .
    laeController example.brx



    This will make a RunDate parameter available in the graph utilizing your shell's date function. In the graph you could name the output file something like /Path/Output_{{*RunDate*}} in the output node, which will result in a file name of Output_20140113 (if you ran it today). Note the use of * when using parameters from a script instead of the usual ^.


  • 4.  RE: Adding time stamp to output

    Employee
    Posted 01-14-2014 08:49

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

    Originally posted by: dialpemo

    Thank you Dan It work perfectly


  • 5.  RE: Adding time stamp to output

    Employee
    Posted 01-23-2014 07:23

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

    Originally posted by: ltolleson

    One more suggestion would be to use the internal parameter {{^CurrentDate^}}. You can use this parameter anywhere in your graph (no definition needed) to give you the current date. Note, this does not include the time. A request has been submitted to get CurrentTime added.

    Also, be aware that with {{^CurrentDate^}} it works fine in BRE (changing each day), but once you produce a BRX, that parameter is converted into a hard-coded string (it stops changing). In other words, it doesn't work for scripted graph executions. If you are using a BRX then use the method that Dan suggested above.