4 Replies Latest reply on Oct 23, 2006 8:36 AM by score1

    Using CFIF statement

    score1
      I have some queries written which show numbers of online modules passed and failed. I can get the percentage pass rate by using the following code:

      <cfset passes = passedmodules.recordcount>
      <cfset fails = failedmodules.recordcount>
      <cfset total = passes + fails>
      <cfset percentage = passes / total * 100>

      This however only works if the recordcount on courses sat is > 1. There are over 1000 profiles this has to work with and it comes back with an error Division by zero is not allowed.

      Thought of using a CFIF statment to check if recordcount is greater than 0 but not sure how to code this in.

      Any help appreciated.