AnsweredAssumed Answered

TypeError: Cannot find function

Question asked by Poyato on Aug 26, 2015
Latest reply on Aug 26, 2015 by Poyato

I have a file. js in the directory E:\CA\PAM\server\c2o\.c2orepository\.c2ouserresources .


in the file have a code:



Date.prototype.addDays = function(days)
{
  var dat = new Date(this.valueOf());
  dat.setDate(dat.getDate() + days);
  return dat;
};

function removeAcento(strToReplace) {
        function removeAcento(strToReplace) {
    str_acento = "áàãâäéèêëíìîïóòõôöúùûüçÁÀÃÂÄÉÈÊËÍÌÎÏÓÒÕÖÔÚÙÛÜÇ";
    str_sem_acento = "aaaaaeeeeiiiiooooouuuucAAAAAEEEEIIIIOOOOOUUUUC";
    var nova = "";
    for (var i = 0; i < strToReplace.length; i++) {
        if (str_acento.indexOf(strToReplace.charAt(i)) != -1) {
            nova += str_sem_acento.substr(str_acento.search(strToReplace.substr(i, 1)), 1);
        } else {
            nova += strToReplace.substr(i, 1);
        }
    }
    return nova;
}
};

 

In PAM i create a Process with a operator javascript with the code:

 

include ('BBFuncoes.js');

var dHoje = new Date();
Process.hoje1 = dHoje.getFullYear() + "-" + adicionaZero(dHoje.getMonth()+1)+ "-" +adicionaZero(dHoje.getDate());
Process.hoje2 = dHoje.getMonth();

var textoComAcentuacao = "O caçador teve a mão  e o pé presos no alçapão"
Process.PureTxt= removeAcento(textoComAcentuacao)


 

but the Process.PureTxt return undefined

Outcomes