Skip to main content

Notifications

Announcements

No record found.

Small and medium business | Business Central, N...
Suggested answer

ERROR An invalid field or attribute has been specified for the 'Format' property.

(0) ShareShare
ReportReport
Posted on by 295

I got an error when i format the number for the report

An invalid field or attribute has been specified for the 'Format' property.

pastedimage1681966081942v1.png

   gTotalRequestAmount := format(1000002, 15, '<Sign><Decimals>');
---------------
 gTotalRequestAmount: Text;
Could you please share your experience on this error ?
  • Suggested answer
    ShanAbeywicrema Profile Picture
    ShanAbeywicrema 940 on at
    RE: ERROR An invalid field or attribute has been specified for the 'Format' property.

    You can use following syntax, it's simple. But your code also working for me. what is the issue you got?

     gTotalRequestAmount := FORMAT(555777.85,15,3);

    pastedimage1681973282843v1.png

    I got same output in BC

    pastedimage1681973646136v1.png

     gTotalRequestAmount := FORMAT("Purchase Header"."Amount Including VAT",15,3);


  • Hoang Ng Profile Picture
    Hoang Ng 295 on at
    RE: ERROR An invalid field or attribute has been specified for the 'Format' property.

    Thanks Shan, Narang

    I want to format Amount with thousand separator. I tried to change parameter value in FORMAT but not successful

    gTotalRequestAmount := FORMAT("Purchase Header"."Amount Including VAT", 0, '<Sign><Integer Thousand><Decimals>')

    Thanks.

  • Suggested answer
    ShanAbeywicrema Profile Picture
    ShanAbeywicrema 940 on at
    RE: ERROR An invalid field or attribute has been specified for the 'Format' property.

    What do you need to achieve. if you use this format string you can specify decimal value. such as 1000002.25

    it should be gTotalRequestAmount := FORMAT(1000002.5, 15, '<Sign><Decimals>');

    if you don't have decimal use something like this

    gTotalRequestAmount := FORMAT(1000002, 15, '<Sign><Integer>');

    get idea from following resources

    learn.microsoft.com/.../format-function--code--text-

    learn.microsoft.com/.../format-property

  • Suggested answer
    NAV_with_Narang Profile Picture
    NAV_with_Narang 2,236 Super User 2024 Season 1 on at
    RE: ERROR An invalid field or attribute has been specified for the 'Format' property.

    If your aim is to convert integer/decimal into a text, just use:

    Text := FORMAT(Integer);

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 Verified Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,445 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans