web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Suggested Answer

Amount in words

(0) ShareShare
ReportReport
Posted on by 14,855

In the SSRS reports, is there any function that transforms amounts into words - The Amount in Words

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at

    If you need to do it at SSRS report level then you need to write VB code to do it

    you can write code at following place SSRS report

    Go to Report menu option and select report properties. Select the Code tab in the dialog box

    Other way if you want to do this conversion in AX

    then create a field in the report RDP class temp table and use

    \Classes\Global\numeralsToTxt_EN()

    method and display the field value in report.

    Please verify if this info helps you.

  • Suggested answer
    venkatesh vadlamani Profile Picture
    3,180 on at

    you can use the global class which converts amount to words based on country specific stuff

    Global::numeralsToTxt*****,, create a method to get the ISO country region code from the current LE instance and call the corresponding class method. Could use default as EN-US

    Regards

    Venkatesh

  • Ali Zaidi Profile Picture
    4,657 on at

    AS other told you can use numeralsToTxt_EN() function, i tried it as follow

    static void Job_AmountInWords(Args _args)

    {

       info(numeralsToTxt(420.420));

    }

  • Wamik Azam Profile Picture
    55 on at

    Hi Guys,

    Can you guide me how to use numeralsToTxt method in SSRS report.

    I will use it for the total of the invoice value of P.O. / S.O.

  • Martin Dráb Profile Picture
    237,961 Most Valuable Professional on at

    Which reports do you mean, exactly?

    For example, if you want it in SalesInvoice report, it's based on a report data provider class (SalesInvoiceDP) and that's where you have to add your change.

  • Suggested answer
    Community Member Profile Picture
    on at

    static void convertAmountInWords()

    {

    str _currency2 = 'Paise',_currency1 = 'Rupees',word, decWord;

    real _amount = 678.56 , decimals;

    int repPos, repPos1,repPos2;

    ;

    word = Global::numeralsToTxt_EN(_amount);

    repPos = strscan(word, ' and', 1, strlen(word));

    decimals = _amount - real2int(_amount);

    if (decimals == 0.00)

    {

       word = strdel(strpoke(word, strfmt(' %1', _currency1), repPos), 1, 4);

       word = strdel(word, strscan(word, '/100', 1, strlen(word)), 4);

    }

    else

    {

       decWord = substr(num2str(decimals, 0, 2, 1, 1), 3, 2);

       decWord = Global::numeralsToTxt_EN(str2num(decWord));

       repPos1 = strscan(decWord, ' and', 1, strlen(decWord));

       decWord = strpoke(decWord, strfmt(' %1', _currency2), repPos1);

       decWord = strdel(decWord, 1, 4);

       word = strdel(strpoke(word, strFmt(' %1 and %2', _currency1, decWord), repPos), 1, 4);

       word = strdel(word, strscan(word, '/100', 1, strlen(word)), 4);

       word = strdel(word, strscan(word, '0', 1, strlen(word)), 4);

       repPos2 = strscan(word, ' and', 1, strlen(word));

       word = strIns(word,'\n',repPos2);

    }

    info(word);

    }

  • Wamik Azam Profile Picture
    55 on at

    Hello Martin,

    Right now I am doing it for PurchPurchaseOrder (Purchase Order Confirmation Report).

    In the PurchPurchaseOrderHeader table I added one display method which looks like.

    display str amount_in_words()

    {

       real num = this.Amount;

       str text;

       return num2Text(num);

    }

    How do I use it in the Report?

    Can you give me some hint please, I am new in working on reports.

    Regards,

    Wamik

  • Suggested answer
    Martin Dráb Profile Picture
    237,961 Most Valuable Professional on at

    If you look into documentation (Purchase order report (PurchPurchaseOrder)), you'll find that this report is based on two temporary tables, PurchPurchaseOrderHeaderTmp and PurchPurchaseOrderTmp, filled in by PurchPurchaseOrderDP class. Therefore you have to add a field to one of these tables (the header, in your case) and fill the field in code called from PurchPurchaseOrderDP.processReport().

    As you already have the method, you just have to assign its return value to the new field.

    The amount is set in two methods of PurchPurchaseOrderHeaderTmp, initFromVendPurchOrderJour() and initFromPurchConfirmationRequestJour(), therefore that's where I would put code for the amount in words too.

    Then you'll use your new field in the report in exactly the same way as other fields.

  • Wamik Azam Profile Picture
    55 on at

    Thanks much Martin for your instant response.

    I understood what I need to do.

    Added a new field in PurchPurchaseOrderHeaderTmp eg. amount_txt and this field is assigned a value in the 2 table methods.

    I have 1 doubt how do I add the field in the processReport there is no field mapping defined.  

    Can't it be used like other fields in the table.

    The new field amount_txt is available in the dataset but when I am trying to use the field I am getting below error on Report build.

    Error 1 The data methods are present in the PurchPurchaseOrder but the data method library cannot be resolved. Set the Data Method Library property and rebuild the project. \SSRS Reports\Reports\PurchPurchaseOrder 0 0 ReportModel4

  • Martin Dráb Profile Picture
    237,961 Most Valuable Professional on at

    I already told you where to do it:

    The amount is set in two methods of PurchPurchaseOrderHeaderTmp, initFromVendPurchOrderJour() and initFromPurchConfirmationRequestJour(), therefore that's where I would put code for the amount in words too.

    The error on build seems to be unrelated to the field. Can you confirm that it disappears if you stop using the field? If it does, therefore it's related to the field in some way, please tell us how you're "using the field".

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans