Custom Command's examples

From GXtest Wiki
Revision as of 22:47, 8 June 2011 by Fbaptista (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Custom command's examples. Add them directly or use them as a guide.

Compare if a date control has today value

   function CustomCommand (paramJS, currentGXVersion, currentLanguage){
       var day=((new Date().getDate()<10) ? "0" : "")+new Date().getDate(); 
       var month=(new Date().getMonth()+1<10) ? "0" +(new Date().getMonth()+1): new Date().getMonth()+1;
       var year=(((new Date().getFullYear())%100<10) ? "0":"") +(new Date().getFullYear())%100;
       var date_var =month.concat("/".concat(day.concat("/".concat(year))));
       if((paramJS==date_var)){
           result = "OK";
       }else{
           result = "Error, is not today";
       }  
   return result;
   }