Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Displaying Amount In Words.

(0) ShareShare
ReportReport
Posted on by 1,536

hi expert, i have query, i want to display sales quotation line amount in words on ssrs report, for this i am using Global::numerlstxt() method, but i did not get any positive result, my code is 

salesquotation.linAmount=Global::numersltxt(custquotationtrans.lineAmount);

this is line give me "operand types are not compatible with the operator"

also i try that declare a new var type of string i.e  str Amount =Global::numersltxt(custquotationtrans.lineAmount)

and then that string assign to salesquotation.lineAmount

i.e saleaquotation.lineAmount=Amount

this also give me "operand types are not compatible with the operator" error, so for that

i just used saleaquotation.lineAmount=str2num(Amount);

error remove, but my desire result not acheving, where is problem,

plz guide me..

Regards.

*This post is locked for comments

  • Tony Mok Profile Picture
    Tony Mok 577 on at
    RE: Displaying Amount In Words.

    Although it is old post, I hope that it will benefit other developers.

    15.50 -> FIFTEEN POINT FIFTY

    strUpr(conPeek(str2con(strRem(numeralsToTxt(Trunc(custquotationtrans.lineAmount)), "*"),"and"),1) + " point " + conPeek(str2con(strRem(numeralsToTxt(decround(frac(custquotationtrans.lineAmount)*100,0)),"*"),"and"),1));

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,614 User Group Leader on at
    RE: Displaying Amount In Words.

    solution provided by Boye is much optimal but it would not be 100% accurate. still it will give you fraction like 00/100

    because that is retuned from numeralsToTxt and you have done nothing inside numeralsToTxt  as per above code

    so, to remove this decimal part such as 00/100, you can modify your function numeralsToTxt , by creating a duplicate of it,

    don't modify standard method as its being used at many places and its a framework class

  • Suggested answer
    RE: Displaying Amount In Words.

    Hi Munsif,

    You are looking for a solution like this:

    YourTableForReport.AstringTypeField = strRem(Global::numersltxt(Trunc(custquotationtrans.lineAmount)), '*') + 'And' + strRem(Global::numersltxt(Frac(custquotationtrans.lineAmount)),'*');

    Small explanation:

    a string can be constructed out of multiple parts by using the '+' sign.

    the function strRem(original text, to remove text) removes in this case the '*' from your string.

    the function trunc(real) will give you the real without decimals.

    the function frac(real) will give you the decimals of the real.

  • Sohaib Cheema Profile Picture
    Sohaib Cheema 46,614 User Group Leader on at
    RE: Displaying Amount In Words.

    you can copy the function, which is available in global class and create a duplicate of that, and write your logic, what ever you want, i.e. removing * and managing decimal part as words

  • munsif Profile Picture
    munsif 1,536 on at
    RE: Displaying Amount In Words.

    thanks sohaib, i got the result, but result is not accurate , suppose the amount is 94000.00 so i got the result like that  "***Ninety four thousand and 00/100", first i want to remove astrik and also need to convert that 00 degits to words,how it would possible.

  • Suggested answer
    Sohaib Cheema Profile Picture
    Sohaib Cheema 46,614 User Group Leader on at
    RE: Displaying Amount In Words.

    common sense suggest to use relevant data type.

    Amount In words is always string. so you must be using string type field to get it back or to save it

    YourTableForReport.AstringTypeField = Global::FunctionForAmtInWrds(AnyRealNumber);

  • munsif Profile Picture
    munsif 1,536 on at
    RE: Displaying Amount In Words.

    thanks , honathan, i also added new field in salesquotation table, but one thing more i would like to ask from you which type of new field i will need to add in table, string or real, etc, i adding real,

  • Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Displaying Amount In Words.

    Hi  Munsif-ur-Rehman,

    I am not a developer but often use vendor check payments and noticed that the check payment amount is printed in words on the SSRS report. Maybe have  look at the VendOutPaym_Cheque class to see if you can make use of some code parts that are already there.

    Hope it helps,

    Ludwig

  • Suggested answer
    Jonathan  Halland Profile Picture
    Jonathan Halland 11,306 on at
    RE: Displaying Amount In Words.

    Hi Munsif.

    Your code is trying to convert a number to a language representation and then trying to assign that to a numeric field. This will never work logically.

    You would need to create a new field on sales quotation called "lineAmountWords" to which you assign the result of numersToTxt.

    e.g.

    Global::numersltxt(100) will return

    str2num("One hundered"); - This will never work as "one hundred" is not a number.

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

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans