Thane,
Make your fields part of a structure...
<cfset a = structnew()>
<cfset a.Field1 = "regNumber,10,Registration Number, text,,">
..... etc.....
Then, in your loop code,
<Cfset i1 = 1>
<cfset i2 = 2>
<cfloop collection="#a#" item="item">
<cfloop List="#a[item]#" index="listmember">
<cfset FieldInfo[i1][i2]= listmember >
...etc...
<cfset i2 = i2 + 1>
</cfloop>
<cfset i1 = i1 + 1>
</cfloop>
Of course depending on what you are trying to do there are probably easier
ways to accomplish it. Your data structure seems unconventional, but I'm
only seeing a tiny piece of it of course. Perhaps the point is to convert a
bunch of individual data members into a 2d array. An array of structures
might be a better choice if you have more than one collection of these
individual data members.
-Mark
-----Original Message-----
From: Thane Sherrington [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 26, 2003 8:25 AM
To: CF-Talk
Subject: Getting rid of evaluate
How would I get rid of the evaluates in the following code?
Thanks,
T
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<!--- Set up the fields array --->
<cfset FieldInfo=ArrayNew(2)>
<!--- Array layout:
[FieldName][Length][Label][Type][Validation]
--->
<cfset Field1="RegNumber,10,Registration Number,Text,,">
<cfset Field2="FirstName,40,First Name,Text,,">
<cfset Field3="LastName,40,Last Name,Text,,">
<cfset Field4="Street,40,Street,Text,,">
<cfset Field5="City,40,City,Text,,">
<cfset Field6="Province,2,Province,Text,,">
<cfset Field7="Country,40,Country,Text,,">
<cfset Field8="PostalCode,7,Postal Code,Text,,">
<cfset Field9="PhoneNumber,12,Phone Number,Text,,">
<cfset Field10="EMailAddress,40,EMail Address,Text,,">
<cfset Field11="EMailAddress,40,EMail Address,Text,,">
<cfset Field12="PlaceOfBirth,10,Place Of Birth,Text">
<cfset Field13="DateOfBirth,10,Date Of Birth,dd/mm/yyyy">
<cfset Field14="PlaceOfDeath,10,Place Of Death,Text">
<cfset Field15="DateOfDeath,10,Date Of Death,dd/mm/yyyy">
<cfset Field16="RelationshipTypeID,2,RelationshipType,,">
<cfset TotalFields=16>
<cfloop index="FieldNumber" from="1" to="#TotalFields#">
<cfset CurrentFieldName="Field"&FieldNumber>
<cfloop index="Data" from="1"
to="#ListLen(Evaluate(CurrentFieldName))#">
<cfset
FieldInfo[FieldNumber][Data]=ListGetAt(Evaluate(CurrentFieldName),Data)>
</cfloop>
</cfloop>
<cfloop index="FieldNumber" from="1" to="#TotalFields#">
<cfset CurrentFieldName="Field"&FieldNumber>
<cfloop index="Data" from="1"
to="#ListLen(Evaluate(CurrentFieldName))#">
<CFOUTPUT>
#FieldInfo[FieldNumber][Data]#
</CFOUTPUT>
</cfloop>
<br>
</cfloop>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4