MACROMEDIA COLDFUSION 4.5-CFML LANGUAGE Reference page 158

Cfml language reference
Table of Contents

Advertisement

134
Examples
This example employs a COM object to output a list of files. In this example,
collection of
<CFOBJECT CLASS=FileFunctions.files
NAME=FFunc
ACTION=Create>
<CFSET FFunc.Path = "c:\">
<CFSET FFunc.Mask = "*.*" >
<CFSET FFunc.attributes = 16 >
<CFSET x=FFunc.GetFileList()>
<CFLOOP COLLECTION=#FFUNC# ITEM=file2>
<CFOUTPUT>
</CFOUTPUT>
</CFLOOP>
This example loops through a structure (used as an associative array):
...<!--- Create a structure and loop through its contents --->
<CFSET Departments=StructNew()>
<CFSET val=StructInsert(Departments, "John ", "Sales ")>
<CFSET val=StructInsert(Departments, "Tom ", "Finance ")>
<CFSET val=StructInsert(Departments, "Mike ", "Education ")>
<!--- Build a table to display the contents --->
<CFOUTPUT>
<TABLE cellpadding= "2 " cellspacing= "2 ">
<TR>
<TD><B>Employee</B></TD>
<TD><B>Dept.</B></TD>
</TR>
<!--- In CFLOOP, use ITEM to create a variable
called person to hold value of key as loop runs --->
<CFLOOP COLLECTION=#Departments# ITEM= "person ">
<TR>
<TD>#person#</TD>
<TD>#StructFind(Departments, person)#</TD>
</TR>
</CFLOOP>
</TABLE>
</CFOUTPUT>
...
objects.
file2
#file2.name# <BR>
CFML Language Reference
is a
FFUNC

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-CFML LANGUAGE and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Coldfusion 4.5

Table of Contents