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

SQL code to upate one Legal entity banner to all the legal entity in D365

 Hi, update companyimage set  companyimage.Image  = companyimageA.Image  from  ( select Image from companyimage where dataAreaid = 'USF...