Compare record field with another record field of samerecordset

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Compare record field with another record field of samerecordset

    :confused;

    ... but I don't know how to refer to field of next record in loop through recordset. Any ideas?

    Thanks,

    WolfShade

    WolfShade_2k Guest

  2. Similar Questions and Discussions

    1. Displaying only a part of a record field
      I would like to output only a part of a record field which is returned by a query. For example the outputed text would look like: "Drawing has...
    2. Retrieving a field from the NEW record
      Hi all, I'm tearing my hair out trying to solve the following problem. I want to be able to retrieve the value of the primary key in a trigger...
    3. Fill a field from the previous record
      I want to fill in one (1) text box with data from the previous record (same text box). I've used the code from:...
    4. Duplicate value appears on page for 1 field in 1 record
      This is very very strange. I have an ASP page that reads records from a database and displays a list of them on the screen. For some reason the...
    5. updating a record on a form based on another field
      Please help. I am trying to update a record in a form based on another field in that form. I have tried using the Me! and dlookup options I found...
  3. #2

    Default Re: Compare record field with another record field ofsame recordset

    say your myQuery returned a bunch of numbers...then you would loop through the
    query results and do the comparison inside the loop as follows..

    <cfloop query="myQuery" index="i">
    <cfif myQuery EQ myQuery[i+1]>
    Do this
    </cfif>
    </cfloop>

    adonis1976 Guest

  4. #3

    Default Re: Compare record field with another record field ofsame recordset

    Originally posted by: adonis1976
    <cfloop query="myQuery" index="i">
    <cfif myQuery EQ myQuery[i+1]>
    Do this
    </cfif>
    </cfloop>
    So I can refer to the position within the returned recordset simply by
    bracketing the index after the query name?? Like so;
    <cfset ths=0>
    <cfloop query="get_all_answers" index="idx">
    <cfif get_all_answers[idx] eq get_all_answers[idx+1]>
    <cfset ths = ths+1>
    </cfif>
    </cfloop>
    <cfif ths gt 0><cfoutput>There are #ths# duplicates in the query</cfoutput>

    Like that?

    WolfShade
    ^_^



    WolfShade_2k Guest

  5. #4

    Default Re: Compare record field with another record field ofsame recordset

    You are right.. your loop should work..
    adonis1976 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