Ok back again! lol

I can easily use the ListSort to sort a predefined list:

<cfset myList = ListSort("wango, tango, jango,lolo,alpha","TextNoCase","ASC")>

Which results in a simple text in alphabetical order like so:

alpha, jango, lolo, tango, wango

What I WANT to do though is sort through a dynamic list which I thought would be something like this:

<cfset displayList = ListSort("#myList#", "TextNoCase", "ASC")>

Is it not possible to sort a dynamic list?

The unordered list I want sorted is saved temporarily in another file, then pulled in with a cfinclude.

<cfinclude template="vendorProductList.cfm">

I thought I could wrap the cfinclude with a <cfsavecontent variable = "myList"> and then sort the list with the above ListSort code. Dont know why this should work. Well other than my code order might be wrong. Any ideas anyone? Thanks in advance!

Edited by teedoff: n/a

7 Years
Discussion Span
Last Post by teedoff

I would answer, but looks like you're already being helped on the adobe forums :P


hahaha...yep helped into finding out this wont work either! lol..sheesh I cant win the last few weeks...I get one thing working, but turns out thats the way it keeps something else from working...lol

I guess you must be the only guy here keeping the CF forum alive..lol


I've had those weeks before .. and they're hell. But since you are parsing/manipulating html, sad to say that's par for the course, lol.

Yeah, lately there's almost no action here. Adobe's forum is the go-to-place I guess.


yes adobe forums for coldfusion is great. jQuery forums are few and far between though...lol

Im thinking maybe I need to scale back to just one form field for my lists...making it a single dimension array, then somehow work from there to sort them, which I think now would be possible. Then also somehow figure out how to "grab" a certain list item in order to add formatting(style).

But then I think I'm back to square one where trying to figure out which item to style would be impossible! lol


Styling dynamic values is difficult at best. You have to at least know what type of value you're working with. And it has to be kept separate from any html. Otherwise, it's impossible to do it reliably imo.


I'm unsure as to how you are referring to dynamic list.
I do understand your temporary list is residing in a file.
Which means this solution may work for you.

<cffile action="read" file="#ExpandPath('/temp.cfm')#" variable="myList" >
<cfoutput>#ListSort("#myList#", "TextNoCase", "ASC")#</cfoutput>

That is the same code they started with. Anyway, it's been 3 months. I'm pretty sure he's solved it by now ;-)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.