Ben Forta - Where are you?...How to Count items in aSession Variable

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Ben Forta - Where are you?...How to Count items in aSession Variable

    Borrowing off of the Shopping Cart program in Ben Forta's book CF 4.0.... I am
    using session variables to create a list of entities that will print to mailing
    labels. After playing with spacing and such I finally have the first column of
    lables printing.

    There are ten labels for each of 3 columns. When session basket count reaches
    11 records I want to start printing in the next column.

    I was considering using the "Session.Basket" as a counter, so that when the
    record count of items in the session basket reaches 11 and then 21 I would
    move the print to a different portion of the table to print the output.

    When I do a CFDUMP is can see the contents of the session basket, and there
    seems to be a row count for each of the records. Is there a way of accessing
    that counter to do any sort of calculations?

    Or, can anyone have any suggestions as to how to do this?

    Thanks

    smokin_joe Guest

  2. Similar Questions and Discussions

    1. Reference Items in a Session Variable
      I am attempting to reference specific items in a session variable. I can access the "Session.Basket.CurrentRow" of any particular ROW , e.g. (...
    2. Items.Count wrong on partial page
      Hi, here's an odd one that blows my mind. I have a DataGrid with paging enabled. I have PageSize=10. I have 25 total items, so that gives me two...
    3. PageCount too high for Items.Count
      I have a datagrid control that is working fine as I update, with what I assume are correct page counts (pre-filtered, there are probably 100 pages...
    4. Handler error in items.count
      Hi I don't know if I've been looking at this project too long, but I've strangly acquired a for the code below; -------------- on MouseUp...
    5. How do I count blocks of characters in a string variable?
      I'm trying to create a code to count a certain character in a string, lets say that I want to know how many letters "o" there are in the text "The...
  3. #2

    Default Re: Ben Forta - Where are you?...How to Count items in a Session Variable

    On 2005-06-09 09:30:48 -0500, "smokin_joe" <webforumsuser@macromedia.com> said:
    > Borrowing off of the Shopping Cart program in Ben Forta's book CF
    > 4.0.... I am using session variables to create a list of entities that
    > will print to mailing labels. After playing with spacing and such I
    > finally have the first column of lables printing.
    > There are ten labels for each of 3 columns. When session basket count
    > reaches 11 records I want to start printing in the next column.
    >
    > I was considering using the "Session.Basket" as a counter, so that
    > when the record count of items in the session basket reaches 11 and
    > then 21 I would move the print to a different portion of the table to
    > print the output.
    >
    > When I do a CFDUMP is can see the contents of the session basket, and
    > there seems to be a row count for each of the records. Is there a way
    > of accessing that counter to do any sort of calculations?
    >
    > Or, can anyone have any suggestions as to how to do this?
    >
    > Thanks
    What kind of data is Session.Basket--is it an array, struct, or something else?

    --
    Matt Woodward
    [email]mpwoodward@gmail.com[/email]
    Team Macromedia - ColdFusion

    mpwoodward *TMM* Guest

  4. #3

    Default Re: Ben Forta - Where are you?...How to Count items in aSession Variable

    The session is set up in the "custom tag" page as <cfset session.basket =
    queryNew("ProductID, CustomerID, SHLastName, SHFirstName, Prefix, BuildingNo,
    StreetName, Suffix, Apt, SHCity, SHState, SHPostalCode")>"

    While playing with different scenarios.... I have been able to retrieve the
    number of records that have been written to the session variable by
    outputting.... "session.basket.recordcount"... NOW the question becomes.... How
    can I reference a particular record in the session.... any suggestions....
    session.basket.recordID - - doesn't work ?

    Thanks !!


    smokin_joe Guest

  5. #4

    Default Re: Ben Forta - Where are you?...How to Count items in a Session Variable

    On 2005-06-09 13:28:41 -0500, "smokin_joe" <webforumsuser@macromedia.com> said:
    > The session is set up in the "custom tag" page as <cfset session.basket
    > = queryNew("ProductID, CustomerID, SHLastName, SHFirstName, Prefix,
    > BuildingNo, StreetName, Suffix, Apt, SHCity, SHState, SHPostalCode")>"
    >
    > While playing with different scenarios.... I have been able to
    > retrieve the number of records that have been written to the session
    > variable by outputting.... "session.basket.recordcount"... NOW the
    > question becomes.... How can I reference a particular record in the
    > session.... any suggestions.... session.basket.recordID - - doesn't
    > work ?
    >
    > Thanks !!
    From what you post here session.basket is a query, so you would
    reference the items as you would any CF query object. Here's a couple
    of links that should help:

    [url]http://tinyurl.com/3w82w[/url]
    (note the "attributes" like RecordCount, etc.)

    [url]http://tinyurl.com/bou9q[/url]
    (check out the Dot Notation, Index Notation, and Mixing Notation sections)

    To get a count of items, if I'm understanding what you're saying it
    would just be Session.Basket.RecordCount. That second link will give
    you a lot of info about how to access specific query records.

    Hope that helps,
    Matt
    --
    Matt Woodward
    [email]mpwoodward@gmail.com[/email]
    Team Macromedia - ColdFusion

    mpwoodward *TMM* Guest

  6. #5

    Default Re: Ben Forta - Where are you?...How to Count items in a Session Variable

    On 2005-06-09 13:44:15 -0500, mpwoodward *TMM* <mpwoodward@gmail.com> said:
    > On 2005-06-09 13:28:41 -0500, "smokin_joe" <webforumsuser@macromedia.com> said:
    >
    >> The session is set up in the "custom tag" page as <cfset session.basket
    >> = queryNew("ProductID, CustomerID, SHLastName, SHFirstName, Prefix,
    >> BuildingNo, StreetName, Suffix, Apt, SHCity, SHState, SHPostalCode")>"
    >>
    >> While playing with different scenarios.... I have been able to
    >> retrieve the number of records that have been written to the session
    >> variable by outputting.... "session.basket.recordcount"... NOW the
    >> question becomes.... How can I reference a particular record in the
    >> session.... any suggestions.... session.basket.recordID - - doesn't
    >> work ?
    >>
    >> Thanks !!
    >
    > From what you post here session.basket is a query, so you would
    > reference the items as you would any CF query object. Here's a couple
    > of links that should help:
    >
    > [url]http://tinyurl.com/3w82w[/url]
    > (note the "attributes" like RecordCount, etc.)
    Sorry, that first link doesn't take you right to the cfquery discussion:
    [url]http://tinyurl.com/crus3[/url]

    Matt

    --
    Matt Woodward
    [email]mpwoodward@gmail.com[/email]
    Team Macromedia - ColdFusion

    mpwoodward *TMM* Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139