Setting Reporting Job Parameters for Specific Times

Follow

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, a JAMS Variable must be used for each value; this is set using a simple PowerShell script as shown below.

### 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
Set-JAMSVariable \Folder\VariableNameYesterday -Value $yesterday

 

##Instead of using Get-Date you could use JAMS cmdlet Convertto-Date.

$date = Convertto-Date Today

##$date would return
##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 2 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 work fine.

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 Paramter to what would be the VariableNameYesterday Variable.

Have more questions? Submit a request

Comments