Skip to main content
February 16, 2014
Question

Using recordcount to send an email when dynamic number is hit

  • February 16, 2014
  • 1 reply
  • 354 views

I have the following script that will fire off an email when a set number is achieved, ie: "minrequire" is set to 6.  When six students have subscribed, an email is sent to the moderator. The problem is the email is being sent multiple times as more students subscribe, instead of only once at 6. Below is the script I am using. Why is this sending more than one emails?

<cfquery name="getNumber" datasource="#application.dsn#">

    select CourseTitle, rid

    from signups

    where courseTitle = '#eventname#' and rid = '#rid#'

    </cfquery>   

    <cfif getNumber.recordcount EQ #getCount.minRequire#>

    This topic has been closed for replies.

    1 reply

    BKBK
    Community Expert
    Community Expert
    February 16, 2014

    You could debug it as follows, to see how often the if-condition is satisfied:

    <cfif getNumber.recordcount EQ getCount.minRequire>

    <p>Start debuggng <br>

    <cfoutput>

    getNumber.recordcount = #getNumber.recordcount# <br>

    getCount.minRequire = #getCount.minRequire# <br>

    </cfoutput>

    End debugging</p>

    <cfabort>