Re: Function to Output a query as an ol or ul

2010-09-12 Thread Ketan Jetty
Hi Rick, The dump is a simulated query, you are right in reality we will not have the depth in the table, this will be a computed column. In this case I am using the ID-parentID relationship to generate the UL/LI order. We could also use depth to the generate the UL-LI order in special cases w

RE: Function to Output a query as an ol or ul

2010-09-12 Thread Rick Faircloth
- From: Ketan Jetty [mailto:kje...@yahoo.com] Sent: Sunday, September 12, 2010 11:50 AM To: cf-talk Subject: Re: Function to Output a query as an ol or ul Tom King, I have done a similar project recently and please find the a similar but much simpler logic to convert the query to unordered list

Re: Function to Output a query as an ol or ul

2010-09-12 Thread Ketan Jetty
Tom King, I have done a similar project recently and please find the a similar but much simpler logic to convert the query to unordered list at http://ketanjetty.com/coldfusion/useful-code/query-to-unordered-list/ I have used your query (modified it to have parentID) as the base query to "que

Re: Function to Output a query as an ol or ul

2010-08-26 Thread Michael Grant
Sorry, I think my syntax is wrong. I think it's menuQ[4].depth. On Thu, Aug 26, 2010 at 3:04 PM, Michael Grant wrote: > You could do it as recursive calls to a function or just do it as > procedural and compare the last record to the current record in order to > know if you need to open and clo

Re: Function to Output a query as an ol or ul

2010-08-26 Thread Michael Grant
You could do it as recursive calls to a function or just do it as procedural and compare the last record to the current record in order to know if you need to open and close new 's. So if menuQ.depth[4] LT menuQ.depth[3] you need to open a new type thing. Make sense? On Thu, Aug 26, 2010 at 11

Re: Function to Output a query as an ol or ul

2010-08-26 Thread Tom King
It sort of makes sense that this is a recursion issue, as I keep hitting the 'You need to know the future' (i.e the next row before it's happened) feeling.. Re: Michael, yes, assume the query is sorted (i.e the depth is how deep the containing UL is). It does my head in. Recursion that is. On 2

Re: Function to Output a query as an ol or ul

2010-08-26 Thread Ian Skinner
I *THINK* what you are trying to do is a classic problem for a recursive function. Create a function that handles one level of your list with the proper and tags. Then for each record inside the logic for the ... test to see if there is another level, if so call the same function. Rough

Re: Function to Output a query as an ol or ul

2010-08-26 Thread Michael Grant
It appears that your row order also indicates the order of you lists? So for instance you want: - One - Two - Three - Four - Five - Six - Seven - Eight Correct? ~| Order the Adobe Coldfusion Anthol

Re: Function to Output a query as an ol or ul

2010-08-26 Thread Tom King
I've updated the dummy data in my example to include multiple depths (i.e nesting) http://neokoenig.pastebin.com/nGBphKVN T On 26 August 2010 16:27, Tom King wrote: > Hi John, > That's fine when you just want a straight: > > > Something > > > But I'm trying to build something with nested ul/

Re: Function to Output a query as an ol or ul

2010-08-26 Thread Tom King
Hi John, That's fine when you just want a straight: Something But I'm trying to build something with nested ul/ol's from the same query object.. T On 26 August 2010 16:22, John M Bliss wrote: > > > > #MyQuery.MyColumn# > > > > On Thu, Aug 26, 2010 at 10:18 AM, Tom King >wrote

Re: Function to Output a query as an ol or ul

2010-08-26 Thread John M Bliss
#MyQuery.MyColumn# On Thu, Aug 26, 2010 at 10:18 AM, Tom King wrote: > > Hi all, > Having not found an existing function to do this (output a query object as > a > nested ol or ul), I thought I'd try my own hand at it - I'm *so* close. > Yet, > not quite there. > > Basically, my

Function to Output a query as an ol or ul

2010-08-26 Thread Tom King
Hi all, Having not found an existing function to do this (output a query object as a nested ol or ul), I thought I'd try my own hand at it - I'm *so* close. Yet, not quite there. Basically, my mind has given up trying to get the logic correct in when to close elements. It works most of the time,