ListPosition is 0 because ListFind looks for a matching *element*, not a
matching *string*. Use ListContains if you want your search for "1" to return
the index of the 1st element which contains a "1".
-David
On Monday, May 07, 2001 10:52 PM, Joshua Tipton [SMTP:[EMAIL PROTECTED]] wrote:
> Why any I reciving this error? Thanks for the code Rich it set me in a new
> direction which I think is better than the one I was going in.
>
>
>
>
>
> <cfloop query="ctrdetail">
> <cfset e1="#e1#">
> <cfset e2="#e2#">
> <cfset e3="#e3#">
> <cfset e4="#e4#">
> <cfset e5="#e5#">
> <cfset e6="#e6#">
> <cfset e7="#e7#">
>
> <cfset eList="e1,e2,e3,e4,e5,e6,e7">
> <cfset eListValues="#e1#,#e2#,#e3#,#e4#,#e5#,#e6#,#e7#">
> <cfset listPosition = ListFind(eListValues, "1")>
> <cfset FinalAnswer = ListGetAt(eList, ListPosition, ",")>
> </cfloop>
> <cfoutput>#FinalAnswer#</cfoutput>
>
> Error Diagnostic Information
>
> An error occurred while evaluating the expression:
>
>
> FinalAnswer = ListGetAt(eList, ListPosition, ",")
>
>
>
> Error near line 71, column 7.
> ----------------------------------------------------------------------------
> ----
>
> Parameter 2 of function ListGetAt which is now "0" must be a positive
> integer
>
>
> > -----Original Message-----
> > From: Steve Reich [mailto:[EMAIL PROTECTED]]
> > Sent: Tuesday, May 08, 2001 1:15 AM
> > To: [EMAIL PROTECTED]
> > Subject: Re: CFIF Help
> >
> >
> > Not sure you gave enough information for a right answer, but you could
> > create two lists to determine which field contains the 1. It's quick and
> > dirty and there's probably a better way, but maybe this will get
> > you looking
> > at it a little differently....
> >
> > <cfset e1="0">
> > <cfset e2="0">
> > <cfset e3="0">
> > <cfset e4="0">
> > <cfset e5="0">
> > <cfset e6="1">
> > <cfset e7="0">
> >
> > <cfset eList="e1,e2,e3,e4,e5,e6,e7">
> > <cfset eListValues="#e1#,#e2#,#e3#,#e4#,#e5#,#e6#,#e7#">
> > <cfset listPosition = ListFind(eListValues, "1")>
> > <cfset FinalAnswer = ListGetAt(eList, ListPosition, ",")>
> >
> > <cfoutput>#FinalAnswer#</cfoutput>
> >
> > HTH,
> > Steve
> >
> > "Joshua Tipton" <[EMAIL PROTECTED]> wrote in message
> > news:<002201c0d762$a513f7d0$[EMAIL PROTECTED]>...
> > > Okay,
> > >
> > > I have a 7 layer error code. I want to do a query to display
> > only the one
> > > that is not 0. e1-e7. Six will be 0 and one will be occupied by a 1.
> > This
> > > is how it will be displayed: <td
> > align="center">#ecode# </td>. What
> > > would the code for all of th <cfif> tags would be. Here is the query:
> > >
> > >
> > > <cfquery name="ctrdetail"
> > > datasource="0424_SQL_TSG_DISPOS"
> > > dbtype="ODBC"
> > > username=""
> > > password="">
> > > SELECT RRDD, SLIC, SONum, ModNum, DateArriv, AttnTo,
> > Creator, E1, E2,
> > > E3, E4, E5, E6, E7
> > > FROM exception
> > > where rrdd ='#url.dis#' and slic = '#url.slic#'
> > > order by datearriv
> > > </cfquery>
> > >
> > >
> > > Joshua Tipton
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists