When parsing the expression, R:Base, like other programming languages, performs the division before the logical test.
Regards, Stephen Markson The Pharmacy Examining Board of Canada 416.979.2431 x251 From: [email protected] [mailto:[email protected]] On Behalf Of Hodges, Dennis Sent: July-17-14 07:15 To: RBASE-L Mailing List Subject: [RBASE-L] - RE: Divide by Zero in Create View Thanks Stephen, This got me working. I'm still curious to know why the other way didn't work. Dennis Hodges Maintenance Management Manager FDOT Office of Maintenance MS #52 PH: (850) 410-5635 FAX: (850) 410-5511 [email protected]<mailto:[email protected]> Please note: e-mail may be subject to public disclosure. From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Stephen Markson Sent: Wednesday, July 16, 2014 12:26 PM To: RBASE-L Mailing List Subject: [RBASE-L] - RE: Divide by Zero in Create View Here's one way of doing it. This way the division is never attempted when activity.standard=0. CREATE view summ AS + SELECT t3t.*, activity.activity, activity.unitmeas, activity.standard, + (tothrs/activity.standard) AS standardunits, + (units/(tothrs/activity.standard)*100) AS expectedunits + FROM t3t, activity + WHERE t3t.activity EQ activity.activity AND activity.standard<>0 + UNION ALL + SELECT t3t.*, activity.activity, activity.unitmeas, activity.standard, + 0 AS standardunits, 0 AS expectedunits + FROM t3t, activity + WHERE t3t.activity EQ activity.activity AND activity.standard=0 Regards, Stephen Markson The Pharmacy Examining Board of Canada 416.979.2431 x251 From: [email protected]<mailto:[email protected]> [mailto:[email protected]] On Behalf Of Hodges, Dennis Sent: July-16-14 11:17 To: RBASE-L Mailing List Subject: [RBASE-L] - Divide by Zero in Create View I have the following code in an EEP. When the value of activity.standard=0 I get a divide by 0 error. How can I correct this select statement? CREATE view summ AS + SELECT t3t.*, activity.activity, activity.unitmeas, activity.standard, + (iff("activity.standard=0",0,(tothrs/activity.standard))) AS standardunits, + (iff("activity.standard=0",0,(units/(tothrs/activity.standard)*100))) AS expectedunits + FROM t3t, activity + WHERE t3t.activity EQ activity.activity Also, when I try to open view sum, my system locks up and I can't do anything, not even close R:Base. I have to end the process using the Task Manager. I am running R:Base eXtreme 9.5 (32) Version 9.5.4.30626 and Windows 7 Enterprise Service Pack 1. Dennis Hodges Maintenance Management Manager FDOT Office of Maintenance MS #52 PH: (850) 410-5635 FAX: (850) 410-5511 [email protected]<mailto:[email protected]> Please note: e-mail may be subject to public disclosure.

