Why are you bothering with those functions?  Not to mention the fact
that you haven't 'var' scoped any of the local variables, and that
they can all be simplified to a single line (function
isNullNumeric(str) { return NOT isNumeric(str); }).

Surely this is simpler (note the isNumeric call directly in the 'null'
attribute's value.:

<cfqueryparam value="#getRecordData.categoryid#"
cfsqltype="CF_SQL_INTEGER"
null="#NOT isNumeric(getRecordData.categoryid)#">

No extraneous UDFs, no extraneous conditionals, and much easier to
read, because 'isNumeric' clearly communicates what it's doing
(checking for numericalness), while 'isNullNumeric' merely
communicates that the value might be considered null, but gives no
indication as to why it might be considered null.

cheers,
barneyb

On 4/26/05, Pete Ruckelshaus <[EMAIL PROTECTED]> wrote:
> OK, here's what I did, a bit more elegant than the first time.  I
> added the following to my UDF library include file:
> 
> function isNullNumeric(str) {
>         if (isNumeric(str)) {
>                 response = "no";
>         } else {
>                 response = "yes";
>         }
>         return response;
> }
> 
> function isNullString(str) {
>         if (len(trim(str)) GT 0) {
>                 response = "no";
>         } else {
>                 response = "yes";
>         }
>         return response;
> }
> 
> function isNullDate(str) {
>         if (isDate(str)) {
>                 response = "no";
>         } else {
>                 response = "yes";
>         }
>         return response;
> }
> 
> And my cfqueryparam, when called, looks like this:
> 
> <cfqueryparam value="#getRecordData.categoryid#"
> cfsqltype="CF_SQL_INTEGER"
> null="#isNullNumeric(getRecordData.categoryid)#">
> 
> Easier and reusable :)
> 
> Pete

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:204629
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to