Ben,
Couple of ideas:
1. If your value is coming from a database, default it to 0 with isNull()
(SQL Server) or nvl() (Oracle). Not sure what DB you're using, but I'm sure
there is an equivalent. This would solve it.
2. If your value is not coming from a database, then do a check before
trying to use max on it:
<cfif NOT len(trim(value1))>
<cfset value1 = 0>
</cfif>
<cfif NOT len(trim(value2))>
<cfset value2 = 0>
</cfif>
<cfif max(value1,value2)>
....
</cfif>
3. You could use an immediate if (iif()) (ugly, but should work):
<cfif max(iif(not len(trim(value1)),DE(0),DE(value)),iif(not
len(trim(value2)),de(0),de(value)))>
....
</cfif>
Not sure of the DE(0), you might have to play with that one. It might just
be 0. Again, ugly, but this basically combines 2 into one line of code.
4. Lastly, write your own isNull function (or get one off cflib.org, which
there is probably one there) or try this:
<cffunction name="isNull">
<cfargument name="original_value" type="any" required="true">
<cfargument name="default_value" type="any" required="true">
<cfif len(trim(original_value))>
<cfreturn original_value/>
<cfelse>
<cfreturn default_value">
</cfif>
</cffunction>
Now in your code:
<cfif max(isNull(value1,0),isNull(value2,0)>
....
</cfif>
----
I think option 1 is best if you can do it, otherwise, option 4 is the best
because it provides you with something you can use again in the future.
HTH,
Dave
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f
Archive:
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:4165
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15