My code works.  But I was wondering if there was a better solution?

I didn't originally have the "null" attribute at all, but added it
when I had an issue.  I did an update from my web page form and even
though empty strings were submitted to that date, what got put into
the database was "1/1/00".  So I added this logic to populate the null
attrib.

I think it's fairly elegant (though using the YesNoFormat() kinda bugs
me), but I'm wondering if I'm missing a better way.

I guess instead of using YesNoFormat(), I could do a REFind() to find
any character, then that would return a true boolean.  But I'll bet
that's slower than YesNoFormat().

.......
        var opposite = structNew();
        opposite['yes'] = false;
        opposite['no'] = true;
</cfscript>
<cfstoredproc procedure="xxx" datasource="xxx">
        <cfprocparam type="in"
                value="#dateIn#"
                null="#opposite[yesNoFormat(len(dateIn))]#"
                CFSQLType="CF_SQL_DATETIME"
        >
</cfstoredproc>

I think CF needs either ....
1. a function that returns true if a string has length, and false if
it doesn't, or
2. for more general use, a function that will return true if a value
evaluates to true (like a number, when using the len() function), and
false otherwise.  I could use that in place of the YesNoFormat() and
keep formatting type functions out of my model layer.

I'm in MX 7, on iis/Windows.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:267235
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to