0
votes

I have a simple parameter where I should pass the first day of current month. What should I write on property value?

enter image description here

2

2 Answers

0
votes

You can create a custom parameter, which allows you to set it to the return value of a Javascript function:

function(){
  var now = new Date();
  return now.getMonth() + 1;
}

When you load the dashboard the parameter will be calculated and will have an integer value between 1 and 12.

If you want the parameter to have as value the date string for day 1 of this month you can instead use

function(){
  var now = new Date();
  var y = now.getFullYear();
  var m = now.getMonth()+1;
  m = (m<10 ? '0' : '') + m;
  var d = '01';
  return y + '-' + m + '-' + d;
}

This will return the date as a string in the format yyyy-MM-dd for day 1 of the current month.

0
votes

As far as i know, the properties file cannot have a formula that will calculate on run time when you use the value.

What you can do instead, is in the beggining of your Job have a KTR that will set this variable for you.

You KTR should look something like this:

enter image description here

Set the parameter date_mois (exact same name) in your Root Job, and this variable will be passed down to subsequent KTR / JOB calls (This is default unless uncheked).