Just a little tweaking and it worked…

 

<cfloop query="test">

  <cfset lo=  99999999>

  <cfset hi= -99999999>

  <cfloop list="#Perf_1m#,#Perf_3m#,#Perf_6m#,#Perf_1y#,#Perf_2y#,#Perf_3y#,#Perf_4y#,#Perf_5y#,#Perf_7y#,#Perf_10y#,#Perf_15y#,#Perf_20y#,#Perf_si#,#Perf_ytd#" index="item">

    <cfif evaluate('#item#') LT lo>

      <cfset lo= evaluate('#item#')>

    </cfif>

    <cfif evaluate('#item#') GT hi>

      <cfset hi= evaluate('#item#')>

    </cfif>

  </cfloop>

  <!--- hi and lo now contain highest and lowest values --->

 

</cfloop>

 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Bob Keleher
Sent:
Tuesday, May 07, 2002 11:32 AM
To: [EMAIL PROTECTED]
Subject: Re: [CFTALKTor] High and low's

 

Andrew,

 

 I think something like this will do it (not tested):

 

<cfloop query='myQuery'>
  <cfset lo=  99999999>
  <cfset hi= -99999999>
  <cfloop list="field_a,field_b,field_c,field_d" index="item">
    <cfif evaluate('myQuery.#item#') LT lo>
      <cfset lo= evaluate('myQuery.#item#')>
    </cfif>
    <cfif evaluate('myQuery.#item#') GT hi)>
      <cfset hi= evaluate('myQuery.#item#')>
    </cfif>
  </cfloop>
  <!--- hi and lo now contain highest and lowest values --->

 

</cfloop>

 


Bob

----- Original Message -----

From: Andrew Green

Sent: Tuesday, May 07, 2002 10:37 AM

Subject: [CFTALKTor] High and low's

 

Is there an easy ( ha, ya right!) way to find the highest and lowest values within a single record when looking at multiple fields.

 

Example:

 

In record One…

Which is highest? Field a, field b, field c or field d

Which is lowest? Field a, field b, field c or field d

 

 

Andrew Green

Reply via email to