It'll be slow, but it might work.
Step 1. run a query to get your records. Use your database to produce a
field in your select list that consists of a concatonation of the letter a and
the id in question, cast as a string. Also include a number of dummycolumns at
the end. Give them some string value, 'aaaa' is a good value. Your recordset
id | concatonation | other fields | dummyfield1 | dummyfield2 etc
1 | a1 | whatever | aaaa |
11 | a11 | whatever | aaaa | aaaa
5 | a5 | whatever | aaaa |
22 | a22 | whatever | aaaa | aaaa
etc. So far the sort order doesn't matter.
Then start doing this sort of thing, only with proper syntax.
<cfloop query="yourquery" index = "ii">
<cfset x = QuerySetCell(yourquery, dummy1, mid(concatonation, 2, 1), ii>
Then do a Q of Q ordered by dummy1, dummy2, etc
Originally posted by: STeja
I have gone thru the related recursion topics, however I can not use SQL based
solutions since the db structure cannot be changed.
so here is my problem:
Table GROUPS has fields (id,parentid,name) -- no referential integrity on
this table. id is the only (primary )key declared.
And I have to display it in hierarchical order:
etc... ignore the crappy example above, I just made up those group names. but
u get what I mean... Can anyone plz refer me to a solution? I have been
breaking my head over this for more than a couple of hours but nouse. I tried
to use cffunction, have a main query that is cached and the recursive function
hits this cached query for its subqueries. But something to do with the
variable scopes I think, it totally failes to bring out the solution Can anyone
plz clear this once for all?