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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

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)
  • Wamik Azam Profile Picture
    55 on at
    RE: Amount in words

    Hello Martin,

    Removing the expression I am not getting the error.

    I will rework on it once again and let u know with the result.

    Thanks much.

    Regards

    Wamik

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Amount in words

    Please try to remove the expression then to find out whether it's related or not. If it is, sharing your expression with us would be useful.

  • Wamik Azam Profile Picture
    55 on at
    RE: Amount in words

    I just dragged the new field in the SSRS report and it gave error.

    I have commented the lines which was assigning value to the table field AmountInWords.

    Still the error is same during Report Build. In the report I just dragged the new field AmountInWords as an expression.

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Amount in words

    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".

  • Wamik Azam Profile Picture
    55 on at
    RE: Amount in words

    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

  • Suggested answer
    Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Amount in words

    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
    RE: Amount in words

    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
    Community Member Profile Picture
    on at
    RE: Amount in words

    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);

    }

  • Martin Dráb Profile Picture
    235,928 Most Valuable Professional on at
    RE: Amount in words

    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.

  • Wamik Azam Profile Picture
    55 on at
    RE: Dynamics AX Reports - Function - Amount in words

    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.

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Mea_ Profile Picture

Mea_ 4

#3
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans