Convert Number To Word

Certified Associate Developer

I'm using Appian Version 21.4 and I has a task to convert number to word, I tried to use "convertnumbertoword" function but it is not exists.

Can some one help me to achieve this task?

  Discussion posts and replies are publicly visible

Parents
  • without plugin, I have solved but its for 3 digit number,
    but we can do it for 2 digit and more.

    a!localVariables(
      local!num: tostring(ri!num),
      local!o: {
        "",
        "One",
        "Two",
        "Three",
        "Four",
        "Five",
        "Six",
        "Seven",
        "Eight",
        "Nine"
      },
      local!t: {
        "Ten",
        "Twenty",
        "Thirty",
        "Forty",
        "Fivty",
        "Sixty",
        "Sventy",
        "Eighty",
        "Ninty"
      },
      local!ele: {
        "",
        "Eleven",
        "Twelve",
        "Thirteen",
        "Forteen",
        "Fifteen",
        "Sixteen",
        "Seventeen",
        "Eighteen",
        "Ninteen"
      },
      local!digit: a!forEach(
        items: enumerate(len(local!num)),
        expression: tointeger(local!num[fv!index])
      ),
      if(
        len(local!num) = 3,
        concat(
          local!o[index(local!digit, 1, {}) + 1],
          " ",
          "Hundred",
          " ",
          if(
            local!digit[2] = 0,
            {},
            if(
              and(local!digit[2] = 1, local!digit[3] = 0),
              local!t[index(local!digit, 2, {})],
              if(
                local!digit[2] = 1,
                {},
                local!t[index(local!digit, 2, {})]
              )
            )
          ),
          " ",
          if(
            local!digit[3] = 0,
            {},
            if(
              local!digit[2] = 1,
              local!ele[index(local!digit, 3, {}) + 1],
              local!o[index(local!digit, 3, {}) + 1]
            )
          )
        ),
        {}
      )
    )

Reply Children