tim,
start small, start with a  1 dim array.

<cfset myNameArray = arrayNew(1)>

<cfset myNameArray[1] = "Tim">
<cfset myNameArray[2] = "Laureska">

Hello world, my name is
<cfoutput>#myNameArray[1]# #myNameArray[2]#</cfoutput>

-----Original Message-----
From: Tim Laureska [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 29, 2004 10:10 AM
To: CF-Talk
Subject: RE: first time array

Thanks Joe... I'm new to arrays and structures so kinda feeling my way
here... I'd like to stick with an array for now so I can learn how they
work, but not having much success yet

-----Original Message-----
From: Joe Rinehart [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 29, 2004 10:00 AM
To: CF-Talk
Subject: Re: first time array

Hi Tim,

I'm not sure why you're using a two-dimensional array here - also,
this looks like a place where a structure could simplify your life
greatly.  Instead of having to remember "1 = issue, 2 = title, etc.,"
with a structure, you can just name things what they are.

Maybe try something like this:

<cfset cassette_Structure = structNew()>

<!--- Each of these could also be written 'cfset
casette_Structure["issue"]' --->
<cfset cassette_Structure.issue = form.issue>
<cfset cassette_Structure.title = form.title>
<cfset cassette_Structure.date1 = form.date1>
<cfset cassette_Structure.publication = form.publication>

<cfoutput>
#cassette_Structure.issue#<br>
#cassette_Structure.title#<br>
#cassette_Structure.date1#<br>
#cassette_Structure.publication#<br>
</cfoutput>

<!--- CF also provides a type of CFLOOP just for structures --->
<cfloop collection="#cassette_Structure#" item="i">
  <cfoutput>#i#: #cassette_Structure[i]#<br></cfoutput>
</cfloop>

You can expand on this at will - if you need to keep track of multiple
cassettes, you could create a cassette_Array where each element is, in
turn, a cassette_Structure like the one created above.

-Joe


----- Original Message -----
From: Tim Laureska <[EMAIL PROTECTED]>
Date: Tue, 29 Jun 2004 09:42:21 -0400
Subject: first time array
To: CF-Talk <[EMAIL PROTECTED]>

This is the first time I've tried to use an array and I have a very

basic question... how do you get the array contents to display !? this

must be something silly I'm not doing

I have one form template that sends 4 form field entries to a processing

template.  The processing template looks as follows (I'm not exactly

sure the cfsets are right but it doesn't throw an error but nor does it

output anything either):

<cfset cassettes_Array=ArrayNew(2)>

<cfset cassettes_Array[ArrayLen(cassettes_Array)+1][1]=#form.issue#>

<cfset cassettes_Array[ArrayLen(cassettes_Array)+1][2]=#form.title#>

<cfset cassettes_Array[ArrayLen(cassettes_Array)+1][3]=#form.date1#>

<cfset

cassettes_Array[ArrayLen(cassettes_Array)+1][4]=#form.publication#>

<cfoutput>

<cfloop from="1" to="#ArrayLen(cassettes_Array)#" index="i">

#cassettes_Array[i]#<br>

</cfloop>

</cfoutput>

TIA

Tim
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to