Displaying Fraction in Navision

zong817zong817 Member Posts: 11
Dear All,

Have any of you encounter the need to display fraction in Navision? If so, how do you handle it?

I understand that the base unit of measure should be the smallest so that there is no need to use fraction. But, consider the following scenario:

if BOM item A, has 2 components, A1 and A2, with 1 each. This is no problem. But when the master carton C is also part of the component, and 3 A fit into 1 C, how would you handle this case?

The case is in the purchase planning, user need to know how much master carton to purchase if there is an order for 30 A.

if the BOM component setup to be like:

A
A1 1
A2 1
C 0.33 or best if can do 1/3.

then when we do the planning for the component level, we would know to purchase

A1 30
A2 30
C 30 *0.33 = 9.9 or best if can do 30*1/3 = 10

Any ideas?

Many thanks,
Laura

Comments

  • kinekine Member Posts: 12,562
    You cannot change the way how the numbers are saved. It will be still just decimal with limited precision. To use Fraction as you wrote, you need totaly different type and aritmetic.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • matttraxmatttrax Member Posts: 2,309
    You can actually do this, but it's sort of a pain.

    The trick is knowing how many decimal places your number has. I would recommend rounding the number to something finite before doing your calculations.

    So say we have 0.125 as our decimal. Since we have 3 decimal places our denominator will be 10^3 or 1000. Our numerator will be 0.125 * 1000 or 125. So now we have 125 / 1000.

    Now we have to check if the number is reduced enough. So divide 1000 / 125. In this case we get an integer so it is not reduced. Our resulting answer is (125 / 125) / (1000 / 125) = 1/8. If it was not an integer then it could not be reduced anymore.

    If you need sample code let me know, but try and figure it out from what I've provided. You can put the code in the OnFormat trigger of whatever textbox you are trying to show it in.
  • kinekine Member Posts: 12,562
    But for me it is not just about formating the decimal. You need to be sure that if you will do 0.333333 + 0.333333 + 0.333333 =1 and not 0.999999. And this is the main reason why yong wants to do 1/3 + 1/3 + 1/3 = 1. And there can just help if you use base measure unit which is lowest mutual divider of all quantities you want to use.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • jannestigjannestig Member Posts: 1,000
    Kine is right its a little different but i had a call logged with MS support reference Decimal rounding for ILE etc and was told it was a known issue that MS are not going to resolve where say

    In this scenario the customer has an item X with 2 UOMs
    UOM QTY UOM

    CASE 1
    PAIR 1/48 = 0.02083

    now they break about the case which is the BUOM and take out 2 pairs for samples. They enter the line as 2/48 of a CASE which comes out as 0.04167

    The system is unable to handle differences in certain situations so i would agree with Kines statement you would would have to be sure the resultant was exactly what you wanted you may find the decimal precision field on the item card helps you as it is mainly used in manafacturing
  • zong817zong817 Member Posts: 11
    Thanks all~

    what our developer did was creating another field call "denominator" and have the user fill in the packing qty. And when doing the planning calcuation, we will always use qty / denominator, and always round up to integer.

    Good thing the client does not mix the master cartons with different items. And you still need to purchase 1 master carton even if you only put 2 out of 3 quantities in there.

    Thanks for all your inputs.

    Laura
Sign In or Register to comment.