How to convert numbers into Arabic numeric in X++?

some times customers need number with Arabic format like the below picture

so how can you achieve this requirements?

it is very easy task , just create method to convert system numbers to this format as the following

go to AOT and access classes then go to Global class and write the below method

static TempStr num2ar(real numerals)
{

    #DEFINE.NumDec(2)

    str    1        digit;
    str   30        numeralsTxt;
    str  250        characters;

    numeralsTxt= num2str(numerals,0,#NumDec,2,0);
    characters= "";

    while (numeralsTxt)
    {
        digit  = subStr(numeralsTxt,1,1);
        numeralsTxt= strDel(numeralsTxt,1,1);

        switch(digit)
        {
            case '0': characters+= '.';
                      break;
            case '1': characters+= '۱';
                      break;
            case '2': characters+= '۲';
                      break;
            case '3': characters+= '۳';
                      break;
            case '4': characters+= '٤';
                      break;
            case '5': characters+= '٥';
                      break;
            case '6': characters+= '٦';
                      break;
            case '7': characters+= '٧';
                      break;
            case '8': characters+= '۸';
                      break;
            case '9': characters+= '۹';
                      break;
  
        }
        characters+= ' ';
    }
    return characters;
}

After that, you can call this method at any area in your application.

Comments