Translate

Friday, 2 December 2011

Dashboard Compare 2 Prompt dates to see if they are the same and show ERROR

The following script enables to compare 2 date prompts on a dashbaord  to tell the user to select a prior Date less than the current Date warning message..

Insert a text box into a dashboard "Contains HTML"
Then paste the following code into the text box

<head>
<script type="text/javascript">
  var curr =
'@{currentdate}{2013-01-31}';
  var prev=
'@{previousdate}{2012-12-31}';
 


dt1=parseInt(curr.substring(8,10),10);
 mon1=parseInt(curr.substring(5,7),10);
 yr1=parseInt(curr.substring(0,4),10);

 dt2=parseInt(prev.substring(8,10),10);
 mon2=parseInt(prev.substring(5,7),10);
 yr2=parseInt(prev.substring(0,4),10);

  date1=new Date(yr1, mon1, dt1);
 date2=new Date(yr2, mon2, dt2);

 
  if (date1<=date2)
    alert('Please enter the Prior Date value as less than Current Date');
 
//


</script>
</head>

No comments:

Post a Comment

Google Big Query Clone / Copy DataSets / Tables - PROD --> TEST --> DEV Projects

Google Big Query Cloning of Datasets & Tables across GCS Projects. We searched the internet and could not find a simple cloning / ...