Alfasith AX

Alfasith AX
اللَّهُمَّ انْفَعْنِي بِمَا عَلَّمْتَنِي، وَعَلِّمْنِي مَا يَنْفَعُنِي، وَزِدْنِي عِلْمًا

Sunday, October 26, 2014

Overcome from divide by zero error in AX

Hi,

2 ways.

>>
int    a,b,c;
if(b)
    c = a / b;
else
 print " Cannot divide by zero"

OR

c  = a / minOne(b);

//it returns a itself if b is zero because minOne() returns non zero values that we passes. If it is zero then it retuns 1

Above methods is to prevent the stoppage of flow of execution.

Regards,

No comments:

Post a Comment

Get a table ID in SQL - D365

Hi select ID from SysTableIdView where  SysTableIdView .Name = 'CustTable' Regards,