Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Display issues with rounded decimal value in a form field

(0) ShareShare
ReportReport
Posted on by 97

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
    Fares Ben Miled 97 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
    Deepak Agarwal 8,564 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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,458 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans