Gil,

See Ian's advice on using a list loop. They are very handy for this situation, when you're using a comma delimited list! To set up your CFSET you'll sill need to use the evaluate function to create your date. This is the reason

If you don't want to use a list loop as Ian suggested use the listlen function to determine the length of your comma delimited list in the from field.

<cfloop from="1" to="#listlen(form.year)#" index="myIndex">
<cfset
variables.date=#DateFormat(CreateODBCDate(createdate(evalaute("form.year#myIndex#")#,#evalaute("form.month#myIndex#")#,#evaluate("form.day#myIndex#")#
>)),"mm/dd/yyyy")#>
<cftransaction>

<cftry>
INSERT Query
<cfcatch>
</cfcatch
</cftry>

</cftransaction>

</cfloop>

Jeremy Brodie

Gil Wrote:
>
>right now I have:
>
><cfset
>date1=#DateFormat(CreateODBCDate(createdate(form.year1,form.month1,form.day1
>)),"mm/dd/yyyy")#>
><cfset
>date2=#DateFormat(CreateODBCDate(createdate(form.year2,form.month2,form.day2
>)),"mm/dd/yyyy")#>
><cfset
>date3=#DateFormat(CreateODBCDate(createdate(form.year3,form.month3,form.day3
>)),"mm/dd/yyyy")#>
><cfset
>date4=#DateFormat(CreateODBCDate(createdate(form.year4,form.month4,form.day4
>)),"mm/dd/yyyy")#>
>
><cfset dateList="#date1#,#date2#,#date3#,#date4#">
>
>It works, but is very inelegant.
>
>How would one loop through the above?
>
>you can't do a
>
><cfloop from="1" to="4" index="myIndex">
>
><cfset date#myIndex#= ...form.year#myIndex#,form.month#myIndex# ...>
>
></cfloop>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to