ColdFusion queries are flat and non-hierarchical. The Flex control supports data specified in a variety of formats, all of which are hierarchical and not flat. Each time I need to populate a Tree control with dynamic query data I find myself jumping through hoops to convert the data into something Flex can use. The truth is, what I want is something as simple as ColdFusion's tag. That tag lets you pass it a query and a list of columns which it uses to build the nested branches. It does not work for every situation (if you have different levels of nesting, for example) but it does work for most tree driven queries. So, how do you programmatically build nested XML based on ColdFusion queries? The simplest solution would be to use block. That way you wouldn't have to figure out the nesting levels, ). 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.