Help! Iteration/Loop Problem

Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default Help! Iteration/Loop Problem

    <CFQUERY NAME="ticket_info" DATASOURCE="HelpDesk">
    SELECT *
    FROM Help_Desk_List a, NotesTbl b
    WHERE a.Entry_ID = #Close_Ticket# AND b.Ticket_ID = #Close_Ticket#
    ORDER BY b.Notes_Date DESC
    </CFQUERY>


    <cfset first = "yes">
    <cfoutput query="ticket_info">
    <cfif first is "yes">
    <cfmail to="Ruel.*********@***********.com"
    from="Helpdesk@***************.COM" subject="#Name# has closed ticket
    #Entry_ID#."
    server="10.1.100.202">
    Ticket #Entry_ID# is Closed on #Date_Closed# by #Name#

    Note History
    <cfif entry_id is ticket_id>
    Time of Entry: #Notes_Date#
    Priority level: #Priority_Level#
    Description: #Entry_Description#

    Note: #Notes#
    </cfif>
    </cfmail>
    <cfset first = "no">
    </cfif>
    </cfoutput>

    I *want* 1 email with the body then have it loop over for x number of note
    fields. I can only get it to write multiple emails, each with a separate note.

    Captain Ru Guest

  2. Similar Questions and Discussions

    1. #40654 [NEW]: reference causes foreach to fail proper iteration
      From: saeven at saeven dot net Operating system: PHP version: 5.2.1 PHP Bug Type: Scripting Engine problem Bug description: ...
    2. loop problem
      Hi, what is wrong with this part of code? I wish to get all values from mysql_query, but don't get the first element, the last one empty... ...
    3. Calling a SP multiple times from an ASP page....SP runs first iteration only
      Hi, I have an asp page which is called with posted data from a previous asp page containing a form, one of the posted fields in SvrName which is...
    4. Array and hash iteration questions
      I have a CSV file and I'm trying to do a few things with it. Essentially what it boils down to is: count the number of times a certain value is...
    5. How to bail from an iteration but not the program?...
      All- How can I terminate the running of a program from within an iteration, but not leave the program? EG, In this code: ...
  3. #2

    Default Re: Help! Iteration/Loop Problem

    use the group attribute of the cfoutput tag, lets assume there are a number of
    "notes" for each "entry_id"

    <cfset first = "yes">
    <cfoutput query="ticket_info" group="Entry_ID>
    <cfif first is "yes">
    <cfmail to="Ruel.*********@***********.com"
    from="Helpdesk@***************.COM" subject="#Name# has closed ticket
    #Entry_ID#."
    server="10.1.100.202">
    Ticket #Entry_ID# is Closed on #Date_Closed# by #Name#

    Note History
    <cfif entry_id is ticket_id>
    Time of Entry: #Notes_Date#
    Priority level: #Priority_Level#
    Description: #Entry_Description#

    <cfoutput>
    Note: #Notes#
    </cfoutput>
    </cfif>
    </cfmail>
    <cfset first = "no">
    </cfif>
    </cfoutput>

    Ken


    The ScareCrow Guest

  4. #3

    Default Re: Help! Iteration/Loop Problem

    what in the....
    for some reason, the close tickets is not working. 'add' sends an email, 'add notes' sends and email, but 'close ticket' isn't.
    Captain Ru Guest

  5. #4

    Default Re: Help! Iteration/Loop Problem

    got it
    somehow a port found it's way there that shouldn't have
    Captain Ru Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139