Hi,

I found that the structure I wanted to manipulate, which is returned from a query, only has one row but loads of columns. It comes returnes a dataset from a database which was designed by some one else so I have no control over its structure.

So my original idea of taking a subsection of the structure, which I was going to use to display sections of these columns would not be possible, but these columns do have a ColumnList. I am now trying to step through this list in groups of 10. So I' get the first ten elements of the column list, loop through these and then get the next ten and then the next ten until I've been through all the elements in the list.

I'm trying to create a next and previous section, where the user can see results in groups of ten and go back a forth through the result. But unfortunately due to the odd structure of the database table, with one row and
loads of columns I can't simply step through the CFOUTPUT.


On 2/21/06, Charlie Griefer <[EMAIL PROTECTED] > wrote:
Not sure that's really practical, as a structure is unordered.

for example, if i have a structure for employee data (containing keys
firstname, lastname, address, and phone)...i don't believe i have any
control over how the struct is...um...structured.

quick test:

<cfscript>
        foo = structNew();
        foo.firstName   = "charlie";
        foo.lastName    = "griefer";
        foo.address     = "123 Main Street";
        foo.phone                = "555-1212";
</cfscript>

<cfoutput>
        <cfloop collection="#foo#" item="key">
                #key#: #foo[key]#<br />
        </cfloop>
</cfoutput>

<br /><br />

<cfscript>
        for (key in foo) {
                writeOutput(key & ": " & foo[key] & "<br />");
        }
</cfscript>

now, i used tags and cfscript to see if there was any difference in
the order of output between the two (there was not)...but both output
in the following order:

phone
lastname
address
firstname

even though the structure was created in the order of:

firstname
lastname
address
phone

...so if this is a consistent (and unpredictable) behavior...is
'paging thru' a structure 'n' keys at a time really what you're
looking to do?

On 2/20/06, Stephen Adams <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Is it possible to get a section of a structure, for example can I get the
> first ten key/value pairs of a structure then the next ten. I trying to page
> through a structure ten rows at a time.
>
> I was thinking of using StructCount to get a number for the amount of values
> in the structure then using that some how to step through the structure. Has
> anyone every done something like this?
>
> Stephen
>  ----------------------------------------------------------
>  You are subscribed to cfcdev. To unsubscribe, send an email to
> cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the
> email.
>
>  CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> (www.cfxhosting.com).
>
>  An archive of the CFCDev list is available at
> www.mail-archive.com/cfcdev@cfczone.org


--
Charlie Griefer

================================================
"...All the world shall be your enemy, Prince with a Thousand Enemies,
and whenever they catch you, they will kill you. But first they must catch
you, digger, listener, runner, prince with a swift warning.
Be cunning and full of tricks and your people shall never be destroyed."


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to cfcdev@cfczone.org with the words 'unsubscribe cfcdev' as the subject of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting (www.cfxhosting.com).

An archive of the CFCDev list is available at www.mail-archive.com/cfcdev@cfczone.org

Reply via email to