Skip to main content
Inspiring
May 31, 2007
Question

Iterate a query Row

  • May 31, 2007
  • 7 replies
  • 483 views
I am trying to iterate a query row to make sure none of the values are empty. Here is what i have so far. The problem is in the evaluate section. I can not figure out how to get that list iterator incorporated into the name of the query data. Once again I am having issues with figuring out where #s and evaluate's can be used : ) Any help would be great. Thanks in advance



    This topic has been closed for replies.

    7 replies

    Inspiring
    May 31, 2007
    I figured I was missing something. I completely blew pass that , rather
    important, part. ;^)

    --
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technology, Inc.
    ------------------------------------------------------------------
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) :: http://www.adobe.com/communities/experts/



    "Ian Skinner" <ian.skinner@bloodsource.org> wrote in message
    news:f3n6cf$4t5$1@forums.macromedia.com...
    > Bash - Adobe Community Expert wrote:
    >> Maybe I'm misunderstanding, but the results of a query (recordset) isn't
    >> a list.
    >
    > The results are not, but part of the results is the columnList property,
    > "#getAssums.columnList#" from the OP's example, is a list of the column
    > names returned in the query record set.
    >


    djc11Author
    Inspiring
    May 31, 2007
    Thank you everyone for the several different approaches to this problem.
    Inspiring
    May 31, 2007
    Bash - Adobe Community Expert wrote:
    > Maybe I'm misunderstanding, but the results of a query (recordset) isn't a
    > list.

    The results are not, but part of the results is the columnList property,
    "#getAssums.columnList#" from the OP's example, is a list of the
    column names returned in the query record set.

    Inspiring
    May 31, 2007
    Maybe I'm misunderstanding, but the results of a query (recordset) isn't a
    list. It is a structure. Have you tried something like this:

    <cfloop collection="getAssums" item="itm">
    <cfif structFind(getAssums,itm) eq "">
    <cflocation url="index.cfm?fuseaction=app.showAssumptionsError">
    </cfif>
    </cfloop

    --
    Bryan Ashcraft (remove brain to reply)
    Web Application Developer
    Wright Medical Technology, Inc.
    ------------------------------------------------------------------
    Macromedia Certified Dreamweaver Developer
    Adobe Community Expert (DW) :: http://www.adobe.com/communities/experts/



    "djc11" <webforumsuser@macromedia.com> wrote in message
    news:f3n3nk$1vi$1@forums.macromedia.com...
    >I am trying to iterate a query row to make sure none of the values are
    >empty.
    > Here is what i have so far. The problem is in the evaluate section. I
    > can not
    > figure out how to get that list iterator incorporated into the name of the
    > query data. Once again I am having issues with figuring out where #s and
    > evaluate's can be used : ) Any help would be great. Thanks in advance
    >
    >
    >
    >
    >
    > <cfquery name="getAssums" datasource="abc">
    > SELECT * FROM assum WHERE company_id = '#client_ID#'
    > </cfquery>
    >
    > <cfloop index="colName" list="#getAssums.columnList#">
    > <cfif getAssums.#evaluate(colName)# EQ "">
    > <cflocation url="index.cfm?fuseaction=app.showAssumptionsError">
    > </cfif>
    > </cfloop>
    >


    May 31, 2007
    The code below should get you started.
    Inspiring
    May 31, 2007
    getAssums[colName][getAssums.currentrow] <-- or you can specify the row,
    1, 2 etc.
    HTH
    --
    Tim Carley
    www.recfusion.com
    info@NOSPAMINGrecfusion.com
    Inspiring
    May 31, 2007
    Once again I am having issues with figuring out where #s and
    evaluate's can be used : )

    99 out of 100 times I find just completely eliminating the evaluate()
    function is the easiest solution. Array notation can almost always be
    used more effectively. The fully qualified array notation of a query is
    queryName["columnName"][rowNumber].

    Since you do not have a row loop around your index loop, I presume you
    are returning a single row query from your <cfquery...> tag. With that
    assumption, your if statement would look something like this.

    <cfif getAssums[colName][1] EQ "">

    If you are looping over multiple rows in the getAssums query then change
    the row identifier to a variable representing each row iteration.