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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Decimal calculation inside of product configurator / product model

(0) ShareShare
ReportReport
Posted on by

Hey Guys, i need an idea for a weird situation i am facing.

Maybe someone can quickly recreate it.

In a AX 2012 R2 Product configuration model, i have following attributes set up:

1. Type: integer nr. / bounded to range=  1-99999 - standard value 12700

2.Type: decimal - to be entered by user in configuration

3.Type: decimal - calculation in the model = Field Nr. 2 x 10000

4. Type: integer - calculation in the model = Field Nr. 2 x 10000

When i put "5232,40" in field Nr. 2 in the configuration mask, Outcome is:

Field Nr. 3 (decimal) = 52324000,00 - as i would expect

Field Nr. 4 (integer) = 52323999 - what creates trouble

This happens only, if my decimal number ends with ,3 or ,4 or ,8 or ,9.

What the heck ??

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi StephAX,

        Can you please explain your question clearly again. Where actually your doing this, what output your expecting.

    Thanks

    Suresh

  • Community Member Profile Picture
    on at

    I did this and is working fine:

    real numberConfig = 5232.40;

       int number1 = numberConfig * 10000;

       real number2 = numberConfig * 10000;

       //number1 = number2;

       info(strFmt("%1, %2", number1, number2));

    both results are ok.

  • Community Member Profile Picture
    on at

    Sorry. you're right my text is confusing.

    .

    Here what i want:

    i am using the Product-configurator out of the box

    .

    i want a user to put a value in a blank field.  

    Attribute A = basetype "decimal".

    .

    And i want to use that particular value for a calculation.

    .

    For the calculation i set up two more attributes. One type is "integer" (Attribute B) the other one "decimal" (Attribute C)

    (technet.microsoft.com/.../hh278332.aspx)

    .

    Then i set up the calculations for each target attribute B & C.

    .

    Calculation target attribute B = Attribut A * 10000

    Calculation target attribute C = Attribut A * 10000

    .

    now i experience that:

    Attr. A = 2500 (what the user keys in)

    Attr. B = 25000000

    Attr. C = 25000000,00

    That is expected outcome! true math

    .

    but i also experience:

    Attr. A = 5232,40 (what the user keys in)

    Attr. B = 52323999

    Attr. C = 52324000,00

    The value for Attribute B is mathematicaly just incorrect. and i don't get why that happens.

    I have done hundreds of product models. very complex ones. but never had this issue.

    i hope its more clear now

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi StephAx,

          Still bit confuse with your question,

    You can do this in form level method using modified field. You can write piece of code in that method for your calculation. Try it in form data source > table > particular field > modified. If not please share some screenshots of your form.

    Thanks

    Suresh

  • Community Member Profile Picture
    on at

    Hi StephAx,

          Still bit confuse with your question,

    You can do this in form level method using modified field. You can write piece of code in that method for your calculation. Try it in form data source > table > particular field > modified. If not please share some screenshots of your form.

    Thanks

    Suresh

  • Community Member Profile Picture
    on at

    And your answer confuses me. I don't want to code. I use the product configurator. There is no need to code. Imagine you put the numbers in excel and the result of 100x25 is 2499.

  • Chakib HALILALI Profile Picture
    30 on at

    Hi , have you solved your problem ?

    I have the same on ( AX 2012 R3 CU 11)  

    we can ovveride the result with the api class of our model but it's very embarrassing to do it for every model 


    ConfiguratorAX2012.jpg

  • Suggested answer
    Chakib HALILALI Profile Picture
    30 on at

    Hi,
    Try use this function BUT the Result MUST be in range of INTEGER :
    INT [-2,147,483,647 : 2,147,483,647].

    If [ Ceiling [ Value * Multiplier] / Multiplier != Value , Ceiling [ Value * Multiplier] -1 , Ceiling [ Value * Multiplier]]

    in your case :
    If [ Ceiling [ Field N°2 * 10000] / 10000!= Field N°2, Ceiling [ Field N°2* 10000] -1 , Ceiling [ Field N°2* 10000]]


    Thanks

  • Community Member Profile Picture
    on at

    Hi Chakib,

    actually thats the type of workaround i figured out as well.

    Also (Value * Multiplier)+0.00001 seem to work (at least for my prod.model)

    Anyway, glad that your installation does the same so it is not any other cusomization interfering.

    Thanks for confirming!

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans