Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

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

Display issues with rounded decimal value in a form field

(0) ShareShare
ReportReport
Posted on by 99

Hello everyone,

I have a real field that when user input in should only display the rounded value without any decimals even if zeroes, a simple decRound in the modified method of the field acheived that with the help of changing the NoOfDecimals to 0 and MinNoOfDecimals to 0 but the problem is that when the value is displayed; it isn't aligned properly to the right side even if alignment is set to right, when the form opens it display them as they should be but when hovering over them or selecting them; a wierd space is created which leaves the values not in the right nor centered (I only need right alignement, centered and left work fine though)
This is a screenshot of the form when opened:
field-issue-1.jpg

and this when I move the cursor over the other values and they change their location too:
field-issue-2.jpg

the code in modified of the field is (I tried here to convert value to int in an attempt to solve the issue):

public boolean modified()
{
    boolean ret;
    
    ret = super();

    ProdBOM.BOMQtySerie = real2int(decRound(ProdBOM.BOMQtySerie, 0));
    
    return ret;
}

my guess of the issue is that that space is for decimal values which are some zeroes that aren't shown since when I get NoOfDecimals to Auto and MinNoOfDecimals to Auto then I get the value followed by a comma and 3 zeroes

The field is BOMQtySerie from ProdBOM table and uses BOMQtySerie for EDT (all of these are in standard value and this is AX R2)

My next guess is trying to force these formControl value with the aid of X instead of properties but sadly I can't seem to find any documentation or help to do so
(my attempt is: 

public boolean modified()
{
    boolean ret;
    
    ret = super();

    ProdBOM.BOMQtySerie = real2int(decRound(ProdBOM.BOMQtySerie, 0));
    //ProdBOM_BOMQtySerie.alignment(0);
    //ProdBOM_BOMQtySerie.noOfDecimals(0);
    //ProdBOM_BOMQtySerie.minNoOfDecimals(0);
    
    return ret;
}

My attempt is commented since I don't know the int values correspondance of these methods and it didn't seem to change anything when I type 0 and 1 there)

Thanks in advance and hopefully I explained the issues as better as I could ^_^.

  • Fares Ben Miled Profile Picture
    99 on at
    RE: Display issues with rounded decimal value in a form field

    Hi Deepak and thank you for your suggestion,

    user can update the value in the form so I tried using the modified field of the table like you mentioned but I still got the same result.

    The form, the table, the field and the EDT are all standard that are used in various places so I can't change its type.

    I forgot to mentio this if it could help but the form that I am working on is ProdBOM.

    Thanks again for your thoughts and I am open to others ^_^.

  • Suggested answer
    Deepak Agarwal Profile Picture
    8,566 on at
    RE: Display issues with rounded decimal value in a form field

    Hi Ben,

    Thanks for the detailed explanation about the issue. Here is my thought.

    If you anyways need to round this field, use integer instead of real, also write your business logic in the inert method, if you are expecting the user can update this value from the front end you may consider table modified field method.

    Let me know if this helps.

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... 293,027 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,852 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans