• Hello Tania

     

    Podio calculation while working on JavaScript have their own unique syntax, so anything copied directly off the internet not aimed at Podio calculations might not work. I assume you're trying to convert a number to words in Spanish.

     

    I have referred this github repo (link) and recreated the code to be Podio compatible. Please refer to this link for the code.

     

    Please note, for customized calculations you need to have a basic understanding of JavaScript and Podio calculations compatible code. For a hands on assistance we request you to contact a partner in your region.

    Selected as Best
  • this is it what I get:

    var convert = String(Math.floor(@Importe Contabilidad)); function numeroATexto(numero) {

      const unidades = ["", "uno", "dos", "tres", "cuatro", "cinco", "seis", "siete", "ocho", "nueve"];

      const decenas = ["", "diez", "veinte", "treinta", "cuarenta", "cincuenta", "sesenta", "setenta", "ochenta", "noventa"];

      const especiales = ["diez", "once", "doce", "trece", "catorce", "quince", "dieciséis", "diecisiete", "dieciocho", "diecinueve"];

      const centenas = ["", "cien", "doscientos", "trescientos", "cuatrocientos", "quinientos", "seiscientos", "setecientos", "ochocientos", "novecientos"];

     

      if (numero === 0) return "cero euros";

     

      function decenasY(num) {

        if (num < 10) return unidades[num];

        else if (num >= 10 && num < 20) return especiales[num - 10];

        else {

          const decena = Math.floor(num / 10);

          const unidad = num % 10;

          return decenas[decena] + (unidad > 0 ? " y " + unidades[unidad] : "");

        }

      }

     

      function centenasY(num) {

        const centena = Math.floor(num / 100);

        const resto = num % 100;

        if (centena === 1 && resto > 0) return "ciento " + decenasY(resto);

        return centenas[centena] + (resto > 0 ? " " + decenasY(resto) : "");

      }

     

      function miles(num) {

        const mil = Math.floor(num / 1000);

        const resto = num % 1000;

        if (mil === 1) return "mil" + (resto > 0 ? " " + centenasY(resto) : "");

        return unidades[mil] + " mil" + (resto > 0 ? " " + centenasY(resto) : "");

      }

     

      function millones(num) {

        const millon = Math.floor(num / 1000000);

        const resto = num % 1000000;

        if (millon === 1) return "un millón" + (resto > 0 ? " " + miles(resto) : "");

        return unidades[millon] + " millones" + (resto > 0 ? " " + miles(resto) : "");

      }

     

      let resultado = "";

     

      if (numero < 100) resultado = decenasY(numero);

      else if (numero < 1000) resultado = centenasY(numero);

      else if (numero < 1000000) resultado = miles(numero);

      else resultado = millones(numero);

     

      return resultado + " euros";

    }

  • Hello Tania

     

    Podio calculation while working on JavaScript have their own unique syntax, so anything copied directly off the internet not aimed at Podio calculations might not work. I assume you're trying to convert a number to words in Spanish.

     

    I have referred this github repo (link) and recreated the code to be Podio compatible. Please refer to this link for the code.

     

    Please note, for customized calculations you need to have a basic understanding of JavaScript and Podio calculations compatible code. For a hands on assistance we request you to contact a partner in your region.

    Selected as Best