Using Date Variables inside File Events for Trigger Definitions

Follow

Date Variables can be used in the path, for File Events, in a Trigger Definition in JAMS.

Start with the following:
  1. Create a Variable with a Date format value.  The date format by default is set to MM/DD/YY.  You must supply a date as a default value.
  2. Set the variable using whichever method you choose.  Powershell might work best in this case.  For example, use the "Set-JAMSVariable" command-let to set the variable, make sure you use the format above.
  3. When calling the variable, go to the file event trigger and use this example as a guide to the path for the file:
  4. D:\Temp\MyFile_<<MyVariableDate("MMddyy")>>.txt
  5. This will search for a file with the file name MyFile_060713.txt assuming you have your "MyVariableDate" variable definition set to "06/07/13".
Have more questions? Submit a request

Comments

  • Avatar
    Dawn Engler

    In order for the Trigger to run properly the user needs set to JAMS on the event tab .

  • Avatar
    Louis Diaz-Delgado

    Hello Dawn,

    Adding on to what you said, the selected user must have access to the path of the file. In your case that user was JAMS.

  • Avatar
    Ken Larose

    Current date in the file trigger cannot be used, as this example might suggest because the trigger is not automatically reset when the current date changes.

  • Avatar
    Gennaro Piccolo

    Hello Ken, this is correct, as the date is parsed when the file watch job is started. The variable is not updated until the trigger is reset, or the trigger is changed and the job is recreated again.