UnitPrice Error

SudsSuds Member Posts: 22
I have a mysterious problem where part of a report does not return a value for the unit price.

I have emplimneted a simple IF statement:
  IF Quantity = 0 THEN
    UnitPriceToPrint := ROUND(AmountExclInvDisc / 1,0.00001)
  ELSE
    UnitPriceToPrint := ROUND(AmountExclInvDisc / Quantity,0.00001);
END;

but the report displays a 0 if Quantity=0. I've checked visibility expressions on the indvidual cell, row and column and haven't found anything that should effect the visibility (such as if Quatity=0 than True).

Any help would be much obliged.

Cheers,

Suds

Comments

  • lvanvugtlvanvugt Member Posts: 774
    Wat is the value of UnitPriceToPrint when Quantity = 0?
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • SudsSuds Member Posts: 22
    the value should be the unit price of a specific item we have in our catalogue.
  • Kc_NirvanaKc_Nirvana Member Posts: 146
    Suds wrote:
    I have a mysterious problem where part of a report does not return a value for the unit price.

    I have emplimneted a simple IF statement:
      IF Quantity = 0 THEN
        UnitPriceToPrint := ROUND(AmountExclInvDisc / 1,0.00001)
      ELSE
        UnitPriceToPrint := ROUND(AmountExclInvDisc / Quantity,0.00001);
    END;
    

    but the report displays a 0 if Quantity=0. I've checked visibility expressions on the indvidual cell, row and column and haven't found anything that should effect the visibility (such as if Quatity=0 than True).

    Any help would be much obliged.

    Cheers,

    Suds

    The value 0 must be in field AmountExclInvDisc because if it is not possible to divide anything by zero
    Junior Consultant & Developer in Dynamics NAV

    "I'm worse at what I do best
    And for this gift I feel blessed
    Our little group has always been
    And always will until the end"

    Nirvana - Nevermind - Smells Like Teen Spirit
  • lvanvugtlvanvugt Member Posts: 774
    Suds wrote:
    the value should be the unit price of a specific item we have in our catalogue.
    OK, but what I mean with my question "What is the value of UnitPriceToPrint when Quantity = 0?" is: when you execute the report and you get to your code ...
    IF Quantity = 0 THEN
        UnitPriceToPrint := ROUND(AmountExclInvDisc / 1,0.00001)
      ELSE
        UnitPriceToPrint := ROUND(AmountExclInvDisc / Quantity,0.00001);
    END;
    
    ... what is the value of UnitPriceToPrint when Quantity = 0? Did you try to debug and see what the value of UnitPriceToPrint is in that case?
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • SudsSuds Member Posts: 22
    Kc: I can get the AmountExclInvDisc to print when the quantity is zero which is why this is stumping me. The AmountExclInvDisc is always a positive number and not conditional on Quantity either.

    Ivan: It returns a Zero, or how i set up, a blank when there should always be a positive number.
  • lvanvugtlvanvugt Member Posts: 774
    Then:

    Wat is the value of AmountExclInvDisc when Quantity = 0?
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
  • SudsSuds Member Posts: 22
    AmountExclInvDisc = a positive, displayable value that indicates an items cost when Quantity = 0
  • lvanvugtlvanvugt Member Posts: 774
    OK, I rest my case (I ran out of options now). :-#
    Luc van Vugt, fluxxus.nl
    Never stop learning
    Van Vugt's dynamiXs
    Dutch Dynamics Community
Sign In or Register to comment.