(our exchange server has gone to sleep for the last hour or so, so I'm
reposting. Pls forgive the duplicate)

Hi all

It's not so much the dodgy practice of using an empty query.column to
evaluate as "" (it's old code, OK?) but more when CF7 actually throws
the error.

In the code below, an error "'val' is undefined" is thrown the first
time the variable "val" is used (<cfdump var="#val#">), even though
CF6.1 returns the correct value of "3"

But if CF7 has an issue with trying to use values from empty queries
the error really shouldn't happen until the second <cfdump
var="#val#"> (CF6.1 returns "[empty string]")

It's like CF7 is running 3 times:
1) compile
2) runtime
3) evaluate result of runtime

there's no mention of this behaviour in ColdFusion MX 7 Cumulative Hot
Fix 2 so I suppose it's by design.

any thoughts, comments, etc?

thanx
barry.b

<!---========================================--->
<cffunction name="testEmpty" returntype="string" output="No">
        <cfargument name="add_row" required="No" type="boolean" default="false" 
/>
        <cfset var result = "" />
        <cfset var qryBudget = queryNew("cmpy_code,budget_no") />
        <!--- toggle the test row to simulate an empty query --->
        <cfif arguments.add_row is true>
                <cfset queryAddRow(qryBudget,1) />
                <cfset querySetCell(qryBudget, "cmpy_code", "10") />
                <cfset querySetCell(qryBudget, "budget_no", "3") />
        </cfif>                 
    
          <cfswitch expression="#qryBudget.budget_no#">
                <cfcase value="1"><cfset result = "1"><cfbreak></cfcase>      
                <cfcase value="2"><cfset result = "2"><cfbreak></cfcase>
                <cfcase value="3"><cfset result = "3"><cfbreak></cfcase>        
                                
            <cfdefaultcase>
                  <cfset result = ""><!--- budget number not set up --->
            </cfdefaultcase>                    
          </cfswitch>
        <cfreturn result />
</cffunction>

 
<cfset val = testEmpty(add_row=true) />
<cfdump var="#val#">
<br />
<cfset val = testEmpty() />
<cfdump var="#val#">
<!---========================================--->

---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]
Aussie Macromedia Developers: http://lists.daemon.com.au/

Reply via email to