Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

Amount in words in Arabic

Posted on by Microsoft Employee

Hi All,

I am trying to use the below method to convert the amount in words in Arabic, but after using this method, all the menus in AX changing to Arabic. 

Kindly assist me.

private TempStr numeralsToTxt(real _num)

{
int numOfPennies = (decRound(frac(_num), 2) * 100) mod 100;
real test = _num - frac(_num);

int64 numOfTenths;
str 20 ones[19], tenths[9], hundreds, thousands, millions, billions, trillions;

int64 temp;
str 200 returntxt;
int64 testLoc;

real modOperator(real a1, real a2)
{
int tmpi;
real tmp1, tmp2;
tmp1 = a1 / a2;
tmpi = real2int(tmp1);
tmp2 = tmpi;
return (tmp1 - tmp2)*a2;
}

real checkPower(real _test, int64 _power)
{
int64 numOfPower;

if (_test >= _power)
{
testLoc = real2double(_test);
numOfPower = testLoc div _power;

if (numOfPower >= 100)
{
temp = numOfPower div 100;
returntxt = returntxt + ' ' + ones[temp] + ' ' + hundreds;
numOfPower = numOfPower mod 100;
}
if (numOfPower >= 20)
{
temp = numOfPower div 10;
returntxt = returntxt + ' ' + tenths[temp];
numOfPower = numOfPower mod 10;
}
if (numOfPower >= 1)
{
returntxt = returntxt + ' ' + ones[numOfPower];
numOfPower = numOfPower mod 10;
}
switch(_power)
{
case 1000000000000 :
returntxt = returntxt + ' ' + trillions;
_test = modOperator(_test, 1000000000000.00);
break;
case 1000000000 :
returntxt = returntxt + ' ' + billions;
_test = modOperator(_test, 1000000000);
break;
case 1000000 :
returntxt = returntxt + ' ' + millions;
_test = modOperator(_test, 1000000);
break;
case 1000 :
returntxt = returntxt + ' ' + thousands;
_test = modOperator(_test, 1000);
break;
case 100 :
returntxt = returntxt + ' ' + hundreds;
_test = modOperator(_test, 100);
break;
}
}
return _test;
}

ones[1] = "@SYS26620";
ones[2] = "@SYS26621";
ones[3] = "@SYS26622";
ones[4] = "@SYS26626";
ones[5] = "@SYS26627";
ones[6] = "@SYS26628";
ones[7] = "@SYS26629";
ones[8] = "@SYS26630";
ones[9] = "@SYS26631";
ones[10] = "@SYS26632";
ones[11] = "@SYS26633";
ones[12] = "@SYS26634";
ones[13] = "@SYS26635";
ones[14] = "@SYS26636";
ones[15] = "@SYS26637";
ones[16] = "@SYS26638";
ones[17] = "@SYS26639";
ones[18] = "@SYS26640";
ones[19] = "@SYS26641";

tenths[1] = 'Not used';
tenths[2] = "@SYS26643";
tenths[3] = "@SYS26644";
tenths[4] = "@SYS26645";
tenths[5] = "@SYS26646";
tenths[6] = "@SYS26647";
tenths[7] = "@SYS26648";
tenths[8] = "@SYS26649";
tenths[9] = "@SYS26650";

hundreds = "@SYS26651";
thousands = "@SYS26652";
millions = "@SYS26653";
billions = "@SYS26654";
trillions = "@SYS101697";


test = checkPower(test, 1000000000000);
test = checkPower(test, 1000000000);
test = checkPower(test, 1000000);
test = checkPower(test, 1000);
test = checkPower(test, 100);

if (test >= 20)
{
testLoc = real2double(test);
numOfTenths = testLoc div 10;

returntxt = returntxt + ' ' + tenths[numofTenths];
numOfTenths = numOfTenths mod 10;
test = real2int(test) mod 10;
}
if (test >= 1)
{
numOfTenths = real2int(test);
returntxt = returntxt + ' ' + ones[numOfTenths];
}

if (numOfPennies)
{
returntxt = '***' + returntxt + ' ' + "@SYS5534" + ' ' + num2str(numOfPennies,0,0,0,0) + '/100';
}
else
{
returntxt = '***' + returntxt + ' ' + "@SYS5534" + ' ' + '00/100';
}

return returntxt;
}

Regards,

Selva

*This post is locked for comments

  • Suggested answer
    Sukrut Parab Profile Picture
    Sukrut Parab 71,647 Moderator on at
    RE: Amount in words in Arabic

    Hi Selva ,

    Are you sure that using this method causing problem ? Please check if you have done any change in settings from user options. Where are you using this method ?

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 291,280 Super User 2024 Season 2 on at
    RE: Amount in words in Arabic

    Hi Selva,

    Is this the full coding of your customization? I don't see any command that could change the language here. Can you share some related coding as well?

    Tip: If you use 'Use rich formatting', you can use a code applet '</>' to paste your coding which would make it more readable. Now the indentation is lost.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans