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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Global::numeralsToTxt(amount) does not work.

(0) ShareShare
ReportReport
Posted on by 45

I have been customizing the purchase order report "PurchPurchaseOrderDP" as I created an extension  of it.

so I need to add the amount of the purchase order and write it in words 

I am trying to use "Global::numeralsToTxt(amount);" 

but the numeralsToTxt does not work.

protected PurchPurchaseOrderTmp initializeOrderLine(
PurchPurchaseOrderHeader _purchaseOrderHeader,
boolean _highlightUpdated,
PurchPurchaseOrderDPOrderLineQuerySelection _orderLineSelection)
{
PurchPurchaseOrderTmp purchPurchaseOrderTmp = next initializeOrderLine(_purchaseOrderHeader, _highlightUpdated, _orderLineSelection);

purchPurchaseOrderTmp.CustomInventBatchId = _orderLineSelection.parmPurchLineAllVersionsInventDim().inventBatchId;
purchPurchaseOrderTmp.Name = InventTable::find(purchPurchaseOrderTmp.ItemId).productName('en-us');

return purchPurchaseOrderTmp;
}

protected PurchPurchaseOrderHeader initializePurchaseOrderHeader(VendPurchOrderJour _vendPurchOrderJour)
{
PurchPurchaseOrderHeader purchPurchaseOrderHeader = next initializePurchaseOrderHeader(_vendPurchOrderJour);

PurchTable purchTable = _vendPurchOrderJour.purchTable();
// PurchTable purchTable2= _vendPurchOrderJour.;


purchPurchaseOrderHeader.CustomPurchId = purchTable.PurchId;
purchPurchaseOrderHeader.CustomVendName = purchTable.PurchName;

purchPurchaseOrderHeader.SalesOrderBalance = _vendPurchOrderJour.SalesOrderBalance ;
purchPurchaseOrderHeader.SumTax = _vendPurchOrderJour.SumTax ;
purchPurchaseOrderHeader.Amount = _vendPurchOrderJour.Amount ;


Amount amount = _vendPurchOrderJour.Amount ;
real amountReal = any2Real(amount);
Description amount2Str;

if (amountReal > 0)
{
amountReal = real2int(round(amountReal , 1));
}
else
{
amountReal = real2int(round(-(amountReal) , 1));
}
str TempStr = numeralsToTxt(amountReal);

amount2Str = Global::numeralsToTxt(amountReal);
amount2Str = subStr(amount2Str,5,strLen(amount2Str)-4);
amount2Str = subStr(amount2Str,strLen(amount2Str)-10,- strLen(amount2Str));
amount2Str = '(Amount:' +' '+ str2Capital(amount2Str) + ' only)';

str dfds=PurchPurchaseOrderDP::AmountInWords(amountReal);

purchPurchaseOrderHeader.Notes = amount2Str ;

return purchPurchaseOrderHeader;
}

pastedimage1648101601907v2.png

pastedimage1648100791392v1.png

pastedimage1648105939649v3.png

pastedimage1648106009731v4.png

I have the same question (0)
  • saffarini Profile Picture
    45 on at

    even casting it did not work :

    str  TempStr = any2Str(Global::numeralsToTxt (1234));

    any advice

  • saffarini Profile Picture
    45 on at

    apparently, after I went through the Global.xpp I found that there :

    so using "numeralsToTxt_EN" = amount2Str = Global::numeralsToTxt_EN(amountReal); solved the problem.

     static TempStr numeralsToTxt(real _num)

    static TempStr numeralsToTxt_BR(real _amount, NumeralsToTxtOptions_BR _options = NumeralsToTxtOptions_BR::default())

     static TempStr numeralsToTxt_EN(real _num)

    static TempStr numeralsToTxt_ES(real             _num,

                                       GenderMaleFemale _gender          = GenderMaleFemale::Female,

                                       boolean          _enclose         = true,

                                       str  _currencyCodeISO = '',

                                       boolean          _isMexican       = false,

                                       boolean          _isCheck         = false)

    static TempStr numeralsToTxt_FR(real _num, boolean _isFrenchCheck = false)

     static TempStr numeralsToTxt_IN(real _num)

    static TempStr numeralsToTxt_NL(real _num, boolean _enclose = true)

  • Suggested answer
    Martin Dráb Profile Picture
    239,784 Most Valuable Professional on at

    Code fron your last code snippet doesn't compile because no such a method exists. Your last screenshot is about a function in electronic reporting, not in X++.

    Use num2text() or numeralsToTxt() instead if numeralsToText(). Prefixing it with Global:: isn't needed.

    By the way, please use Insert > Code (in the rich formatting view) to paste source code. It preserves indentation, which makes code much easier to read.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 554 Super User 2026 Season 1

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 492 Super User 2026 Season 1

#3
Subra Profile Picture

Subra 422

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans