Skip to main content
May 18, 2011
Question

Need help with some Coldfusion data structures

  • May 18, 2011
  • 2 replies
  • 413 views

Hello,

I need to keep some sort of a list that contains a page, and then that page will have associated with it values.  So,

if I have page 1, I may have values 240, 245, 300.  Then, on to page 2, and I will have say, 344, 29, etc.

So, what I will have is something that "could maybe" be a 2 dimensional array where one of the elements is a list?

Or, do I set up a struct say, page.number and page.value list, and put that struct in an array?

Plus, the fun part is I have to save this bad boy in session.  I've been looking around the web for some examples, no

luck.  So, to reiterate:

I have a page number that has to be associated with a list.  That entire structure needs to be in an array or list of

some sort, and stored in session.

Thanks in advance!

    This topic has been closed for replies.

    2 replies

    Inspiring
    May 18, 2011

    I'd base my decision as to how to store this data on what I planned to do with it.

    ilssac
    Inspiring
    May 18, 2011

    Really Google did not show anything like:

    <cfset session.pageAry = [

         {page="pageOne", numList="240,245,300"},

         {page="pageTwo", numList="344,29"}]>

    <cfdump var="#session.pageAry#">

    OR

    <cfset session.pageAry = arrayNew(1)>

    <cfset arrayAppend(session.pageAry, strutNew())>

    <cfset session.pageAry[1].page = "pageOne">

    <cfset session.pageAry[1].numList = "240,245,300">

    <cfset arrayAppend(session.pageAry, strutNew())>

    <cfset session.pageAry[2].page = "pageTwo">

    <cfset session.pageAry[2].numList = "344,29">

    OR

    The <cfscript> version of these examples.

    May 18, 2011

    I didn't find it, but you solved my problem.  I apologize for the short waste of time.

    Again, thanks a lot!!!