Error on Printing Values

MclarenMclaren Member Posts: 47
edited 2011-10-25 in NAV Three Tier
Hi Guys,


There is an issue while I was Print decimal values. For eg:- (It just an example)

I want to get an Amount call X from dividing SUM(CustLedgEntry.Amount) divided by SUM(CustLedgEntry.Quantity).
And One condition is IF the Both values getting divided are Zero the X value also want to be Zero. I wrote the Equation for get the divided value. If the both Values are Zero it prints "#ERROR". Can some one provide me a solution to escape from this issue.Any help will be appreciated.

Comments

  • SavatageSavatage Member Posts: 7,142
    edited 2011-10-24
    What about this post?
    viewtopic.php?f=32&t=49786

    Did you not like the answer you you asked it again?

    if value1 = 0 or value2 = 0
    then result = 0
    else result = value1/value2

    then you use the variable "result" as the sourceexp of the textbox in your report.
  • MclarenMclaren Member Posts: 47
    Yes. I didn't got the answer which I expected. Its an urgent need. Thatz why I posted it again. Can You please help me???????
  • SavatageSavatage Member Posts: 7,142
    He gave you the correct answer so what else were you expecting?

    If it's urgent then you need to hire a professional to do it for you.
    the advise here is free and you shouldn't expect anything within a specific time period.

    If the answer you are looking for is "I'll do it for you for free" then this isn't the correct forum for you.

    You've been given the direction you need to take, now you need to take that advice and try it yourself.
    Just use your logic, this isn;t a difficult task to handle a zero value while dividing.

    What part of the code in Belias' first post didn't help?
  • krikikriki Member, Moderator Posts: 9,112
    Mclaren wrote:
    Yes. I didn't got the answer which I expected. Its an urgent need. Thatz why I posted it again. Can You please help me???????
    If you want urgent support, then buy a support ticket with Microsoft.
    Putting urgent in your message is not the right way to get a response in this forum.

    Please see Forum Rule(s) #3.2: Forum Rules.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • jmagnojmagno Member Posts: 15
    just trying to figure it out what could be the reported problem of Mclaren, I guess that he doesn't fully understand the basic programming, where any type of number that divided by zero will generate an error message, and to get rid of the error message is to add a condition such as if divisor is zero then assigned X value to zero.

    Value1 :=CALCSUMS(CustLedgerEntry.Amount);
    Value2 :=CALCSUMS(CustLedgerEntry.Quantity);
    IF value1=0 or value=0 then
    X:=0
    ELSE
    X:=Value1/Value2;
Sign In or Register to comment.