Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Check if a parameter is NULL

$
0
0
Hi,

I am setting the default value of a parameter in a transformation as 'null'. And in the modified javascript of that transformation I want to check if the parameter value is null or not. Simple if condition is not working, i.e
var today = new Date();
var current_hr=today.getHours();

var dd = today.getDate();
var mm = today.getMonth()+1; //January is 0!

var yyyy = today.getFullYear();
if(dd<10){dd='0'+dd}
if(mm<10){mm='0'+mm}
var today_date =yyyy+'-'+mm+'-'+dd;
var rep_hour="";
var man_date_val=getVariable("man_date","");

if (man_date_val==null)
{
var rep_hour=(current_hr*1)-1;
if(rep_hour <=9)
{
hr="0"+rep_hour;
}
else
{
hr=rep_hour;
}
var date_time=today_date+ " " +hr +"%"
var key_time=today_date+ " " +hr +":00:00";
}
else
{
date_time=man_date_val;
var key_time=date_time;
}

Here, even if man_date default value is null(defined in settings of the transformation), it is always going to the else condition. Any suggestion or help???

Thanks in advance.
Poulomi

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>