Bryan,

In UDF's, you can use the ArrayLen() function to check for the existence of
passed values:

<CFSCRIPT>
function mydate()
{
    var d = "";
    if(ArrayLen(Arguments))
        d = Arguments[1];
    else
        d = Now();
    return DateFormat(d);
}
</CFSCRIPT>

<CFOUTPUT>#mydate("01/01/2001")#</CFOUTPUT>

Dain Anderson
Caretaker, CF Comet
http://www.cfcomet.com/


----- Original Message -----
From: "Bryan LaPlante" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Saturday, June 02, 2001 4:04 AM
Subject: CF5 and UDF's


> Is anyone playing with user defined functions? I can not find any doc's on
> the subject in cfdocs or in studio. I wander if there is a way to do what
I
> am trying below
>
> <CFSCRIPT>
> function mydate(){
>  if (arguments is "")
>   d = now();
>   else
>   d = arguments[1];
>
>  return DateFormat(d);
> }
> </CFSCRIPT>
>
> <CFOUTPUT>#mydate("01/01/2001")#</CFOUTPUT>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to