Hi Tim,

This kind of data could be split into multiple structures, each stored
as an element in an array.  It's a bit more elegant than a struct of
lists.  Quick example:

<!--- Build an array to hold issues --->
<cfset aIssues = arrayNew(1)>

<!--- Build a sample issue --->
<cfset aIssues[1] = structNew()>
<cfset aIssues[1].title="issue1">
<!--- Using createDate() would be more proper, but this is simpler --->
<cfset aIssues[1].date="01/01/2001">
<cfset aIssues[1].title="article1">

<!--- Build a sample issue --->
<cfset aIssues[2] = structNew()>
<cfset aIssues[2].title="issue2">
<!--- Using createDate() would be more proper, but this is simpler --->
<cfset aIssues[2].date="01/02/2001">
<cfset aIssues[2].title="article2">

<!--- Build a sample issue --->
<cfset aIssues[3] = structNew()>
<cfset aIssues[3].title="issue3">
<!--- Using createDate() would be more proper, but this is simpler --->
<cfset aIssues[3].date="01/03/2001">
<cfset aIssues[3].title="article3">

<!--- Output --->
<table>
<!--- Loop over the array of issues --->
<cfloop from="1" to="#arrayLen(aIssues)#" index="i">
  <tr>
  <!--- Loop over each part of an issue structure --->
  <cfloop list="#structKeyList(aIssues[1])#" item="j">
    <td>#aIssues[i][j]#</td>
  </cfloop>
  </tr>
</cfloop>
</table>

Have a good one,

Joe
   

----- Original Message -----
From: Tim Laureska <[EMAIL PROTECTED]>
Date: Thu, 26 Aug 2004 21:45:54 -0400
Subject: RE: structure output
To: CF-Talk <[EMAIL PROTECTED]>

Nope, it helped and I learned a lot from this exercise... thanks again
to all who responded

-----Original Message-----
From: Ewok [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 26, 2004 9:31 PM
To: CF-Talk
Subject: Re: structure output

well it does just what it says : )

Just break one of the listgetat() functions down.....

ListGetAt(item1, 1)

is the same as

ListGetAt("cass1,cass2,cass3", 1)

the list "cass1,cass2,cass3" has three items in it

cass1
cass2
cass3

each item's position in a list is represented by a number form left to
right starting with 1.... in this specific case...

case1 would be at position 1,
case2 would be at position 2
case3 would be at position 3

so.... with the above functions...

ListGetAt(item1, 1)
and
ListGetAt("cass1,cass2,cass3", 1)

both of these would return case1 since it is at position 1 of thie list

I hope that doesnt confuse you even more
   ----- Original Message -----
   From: Tim Laureska
   To: CF-Talk
   Sent: Thursday, August 26, 2004 9:13 PM
   Subject: RE: structure output


   Now we're talking... thanks Ewok... I want to understand this
though...


   I understand the cfsets are setting up lists, but get slightly
confused
   on the rest... if I can, I'd like to take that one step at a time:


   I know this is setting up a loop that loops as many times as there's
   elements in "item1"
   <cfloop from="1" to="#ListLen(item1)#" index="i">


   But this I don't understand:
   #ListGetAt(item1, i)#&


   Listgetat by defintion returns a specific element in a list at a
   specified position.... but can you clarify what that piece of code
does


   -----Original Message-----
   From: Ewok [mailto:[EMAIL PROTECTED]
   Sent: Thursday, August 26, 2004 8:54 PM
   To: CF-Talk
   Subject: Re: structure output


   so you're just having problems with formatting the output?


   <cfset item1 = "cass1,cass2,cass3">
   <cfset item2 = "6/9/04,8/9/04,7/9/04">
   <cfset item3 = "issue1,issue2,issue3">


   <cfoutput>
   <table>
     <cfloop from="1" to="#ListLen(item1)#" index="i">
      <tr>
       <td valign="top">#ListGetAt(item1, i)#&nbsp;&nbsp;</td>
       <td valign="top">#ListGetAt(item2, i)#&nbsp;&nbsp;</td>
       <td valign="top">#ListGetAt(item3, i)#</td>
      </tr>
     </cfloop>
   </table>
   </cfoutput>


     ----- Original Message -----
     From: Tim Laureska
     To: CF-Talk
     Sent: Thursday, August 26, 2004 8:51 PM
     Subject: RE: structure output


     Thanks Erick... I got that to work and looked up and understand the
     replace function now but I guess my follow-on questions are these:


     My 3 key stucture basic output is this:


     cass1,cass2,cass3
     6/9/04,8/9/04,7/9/04
     issue1,issue2,issue3


     which is based on the following processing template receiving input
   from
     a form:


     <cfset me = structNew()>
     <cfset me.mytitle = "#form.title#">
     <cfset me.mydate1 = "#form.date1#">
     <cfset me.myissue = "#form.issue#">


     <table border="1">
     <cfoutput>
     <tr><td>#me.mytitle#</td></tr>
     <tr><td>#me.mydate1#</td></tr>
     <tr><td>#me.myissue#</td></tr>
     </cfoutput>
     </table>


     I still don't understand how to manipulate these comma delimited
   strings
     or space delimited strings into a viewer friendly format?


     And I hate to sound like an idiot, but what does replacing the
commas
     with spaces do for outputting the data anyway ... I'm missing
   something
     here


     -----Original Message-----
     From: Calder, Erick [mailto:[EMAIL PROTECTED]
     Sent: Thursday, August 26, 2004 8:36 PM
     To: CF-Talk
     Subject: RE: structure output


     yournewlist = replace(yourlist, ",", "   ", "all")

**********************************************************************
     E-mail sent through the Internet is not secure. Western Asset
   therefore
     recommends that you do not send any confidential or sensitive
     information to us via electronic mail, including social security
     numbers, account numbers, or personal identification numbers.
   Delivery,
     and or timely delivery of Internet mail is not guaranteed. Western
   Asset
     therefore recommends that you do not send time sensitive or
     action-oriented messages to us via electronic mail.

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

Reply via email to