Division by zero

vijayanderson
Member Posts: 207
Hi Friends,
I got the following error when Invoice has been posted "Division by Zero " 0/0, when sale order is posted.
Regards,
vijay
I got the following error when Invoice has been posted "Division by Zero " 0/0, when sale order is posted.
Regards,
vijay
0
Comments
-
at anytime.u shdn't get this error. [-X0
-
vijayanderson wrote:Hi Friends,
I got the following error when Invoice has been posted "Division by Zero " 0/0, when sale order is posted.
Regards,
vijay
Interesting. Is this 3.56? I never knew that this version was even released in India.
Either way this looks like an error in the Invoice Report, probably some code to print the unit cost by dividing the Amount by Quantity.
Its going to be very hard to fix though, because you will find it very difficult to even find a developer with a license.David Singleton0 -
No. its 4.0 (sp3) with all Hot fixes.0
-
then u are in the wrong forum.
Is there are some customized code?
Did you have checked the source with using the debugger?Do you make it right, it works too!0 -
[Topic moved from 'Navision DOS' forum to 'NAV/Navision' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
yes i have run the debugger, it goes to code unit 6500.0
-
Is the database customized. Start the debugger and check where the error comes. I remember the error used to come when I started using upgraded 4.0 sp3 database, but now i do not remember the solution/cause. Some details might help to remember.CA Sandeep Singla
http://ssdynamics.co.in0 -
vijayanderson wrote:yes i have run the debugger, it goes to code unit 6500.
And where there? Is there some customized source or is it all "standard".
Copy the codesnippes and the functionname here for a better help.
RegardsDo you make it right, it works too!0 -
vijayanderson wrote:yes i have run the debugger, it goes to code unit 6500.0
-
garak wrote:Maybe .....0
-
Just have to add the 0 catch to the code
if C=0
then a=0
else A := B / C0 -
-
or in light of how much infromation the OP has given so far:
A := RAND(1);
which save a lot of lines of code. \:D/David Singleton0 -
-
David ,
, now on my screen is also water
Do you make it right, it works too!0 -
Problem is that if you make some "Workaround" to not have this error, you can be in big troubles, becuase you haven't solved the core problem, just the effect. And it can lead e.g. to some costing problems in future (just example). In most cases, when you get this error, it means that the data are wrong. In cases, when you can assume, that the divider will be zero, there will be appropriate condition. If it is not there, you can assume that when the divider is 0, there is some problem because it cannot be zero from the logic.
Conclusion: just think about the meaning of the code, do not just blindly make "workaround" to prevent this error. There can be deeper problem in this. 8)0 -
With Rand as a user defined function which has this code: http://xkcd.com/221/0
-
kine wrote:Problem is that if you make some "Workaround" to not have this error, you can be in big troubles, becuase you haven't solved the core problem, just the effect.
It's true, rather than write code to blindly prevent the division by zero, it would be better to put in a different, more descriptive, error message. We're so bent on "division by zero should not happen", but forget the underlying problem.
If the process needs to divide by a quantity, and that quantity is 0, the original line is not correct, so the error message should still come up, but with a descriptive message (something like "there is nothing to divide")
0 -
kine wrote:Problem is that if you make some "Workaround" to not have this error, you can be in big troubles, becuase you haven't solved the core problem, just the effect. And it can lead e.g. to some costing problems in future (just example). In most cases, when you get this error, it means that the data are wrong. In cases, when you can assume, that the divider will be zero, there will be appropriate condition. If it is not there, you can assume that when the divider is 0, there is some problem because it cannot be zero from the logic.
Conclusion: just thing about the meaning of the code, do not just blindly make "workaround" to prevent this error. There can be deeper problem in this. 8)
Perfect example is we were trying to show on a form the actual quantity on hand QOH / Item."Sales Unit Of Measure".
Once in a while we get the division error. So as stated above the deeper problem was that someone was not filling in the UOM fields. So the next step was making the UOM mandatory. Therefore solving the deeper underlying problem.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions