A JAMS Report Job contains two Parameters to define the Start Date and End Date of the time range with which the report is run. By default, Yesterday and Today are used respectively.
To be able to use these Parameters with specific times, e.g., Today at 2:00 PM, a JAMS Variable must be used for each value; this is set using a simple PowerShell script as shown below. The Variables used in this example are named "VariableNameNow" and "VariableNameYesterday".
# Import the JAMS module #
Import-Module JAMS #
# Set the powershell date variables using the specified format.
# The addHours method is used to subtract hours from the current time. #
[DateTime]$now = Get-Date -format "MM/dd/yyyy hh:mm tt" $yesterday = $now.addHours(-14) #
# Set the JAMS variables for Now and Yesterday #
Set-JAMSVariable \Folder\VariableNameNow -Value $now -Server JAMSServer Set-JAMSVariable \Folder\VariableNameYesterday -Value $yesterday -Server JAMSServer
# Instead of using Get-Date you could use JAMS cmdlet Convertto-Date. # $date = Convertto-Date Today
# # $date would return the current date in the following format: # Friday, January 23, 2015 12:00:00 AM #
# # To format it you would need to do # $dateStr = $date.ToString("MM/dd/yyyy hh:mm tt")
Users must create two JAMS Variables to update. In this case, VariableNameNow, and VariableNameYesterday are utilized. A Default Value must be defined for each Variable before saving it, any date will suffice.
The Parameters must be associated with each Variable. In the Properties of both Parameters, set the StartDate Parameter to what would be the VariableNameNow Variable and the EndDate Parameter to what would be the VariableNameYesterday Variable.
where to place the powershell script ?
The powershell script is placed in the source tab of a job that uses the Powershell execution method.