[thelist] [ColdFusion] udf question

Pete Freitag pf at cfdev.com
Tue Nov 26 11:15:01 CST 2002


All var declarations need to be at the top of the function (Defined before
anything else). So line 5, var dateYear is the culprit.

_____________________________________________
Pete Freitag
CTO, CFDEV.COM
http://www.cfdev.com/

-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Kyle Murphy
Sent: Tuesday, November 26, 2002 12:01 PM
To: thelist at lists.evolt.org
Subject: [thelist] [ColdFusion] udf question


Because CF5's IsDate(string) function lacks actually checking if the
year is valid, I'm attempting to write a udf to check if it's between
1900-2500.  Here's what I have so far:

Line  1: function myIsDate(date)
Line  2: {
Line  3:  	var tempDate = date;
Line  4:  	if (IsDate(tempDate)) {
Line  5:  		var dateYear = DatePart(yyyy, tempDate);
Line  6:  		if (dateYear gte 1900 AND dateYear lte 2500) {
Line  7:  			return "YES";
Line  8:  		}
Line  9:  		else {
Line 10:  			return "NO";
Line 11:  		}
Line 12:  	}
Line 13:  	else
Line 14:  		return "NO";
Line 15:  }

I'm getting the following error:
---------------------------------------------------
Invalid parser construct found on line 868 at position 3. ColdFusion was
looking at the following text:

var
Invalid expression format. The usual cause is an error in the expression
structure.
---------------------------------------------------

This is my sad attempt at writing my first real udf, so please be nice
:)

Kyle


--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !




More information about the thelist mailing list