ColdFusion queries are flat and non-hierarchical. The Flex
The truth is, what I want is something as simple as ColdFusion’s
So, how do you programmatically build nested XML based on ColdFusion queries?
The simplest solution would be to use
SELECT DISTINCT #ListFirst(ARGUMENTS.cols)# AS col
FROM ARGUMENTS.data
WHERE #PreserveSingleQuotes(ARGUMENTS.where)#
SELECT *
FROM ARGUMENTS.data
WHERE #PreserveSingleQuotes(whereClause)#
SELECT *
FROM ARGUMENTS.data
WHERE #PreserveSingleQuotes(ARGUMENTS.where)#
#BuildTreeXMLProcess(data, cols)#
Now, I did say that the code is not quite done yet. The biggest limitation for now is that the columns listed in cols must all be string values (no numbers or dates). I’ll fix this at some point. For now, if you need to populate Flex Tree controls with ColdFusion query data, this may help.
If you have comments or suggestions, I’d love to hear them.
Leave a Reply