sign in | join about | help | sitemap
Connecting Tech Pros Worldwide
Arielle's Avatar

Max Number in List (Solution)


Question posted by: Arielle (Member) on August 8th, 2008 04:15 PM
The delima was I had a list of numbers that I needed to find the maximum value of. Simply doing Max(ListName) did not work because the Max function requires only two parameters.

What I ended up doing to get around this was converting my list to an array and doing the ArrayMax function

<cfset myList = "1,3,1,2,5,2,2,3,2,3,4">
<cfset maxNum = ArrayMax(ListToArray(myList))>

I figured I'd share this since this seemingly small issue took me a good hour to figure out.
1 Answer Posted
acoder's Avatar
acoder August 8th, 2008 05:05 PM
Site Moderator - 12,588 Posts
#2: Re: Max Number in List (Solution)

You can use a mixture of ListSort and ListFirst/ListLast rather than converting to an array.
Reply
Not the answer you were looking for? Post your question . . .
197,003 members ready to help you find a solution.
Join Bytes.com

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 197,003 network members.
Post your question now . . .
It's fast and it's free

Popular Articles

Top Coldfusion Contributors