Ask a Question related to Macromedia ColdFusion, Design and Development.
-
pglavin #1
max function only allows two arguments?
I need a function that will return the highest value from a set of numerical
variables. The max function only works with two numbers.
e.g. <cfif #crystallization_avg# IS max(#crystallization_avg#,
#specification#, #implementation#)>
Any ideas?
Thanks,
Paul
pglavin Guest
-
named arguments to XS function?
hi there, i'm wondering if it's possible to pass named arguments to an XS function like so: $myObj = Package::Bla->new(arg1=>"hello",... -
[PHP-DEV] named function arguments
Sebastian Bergmann wrote: So, how do you think that isn't known to the original poster as he even explicitely states that he wants to remove the... -
[PHP-DEV] named function arguments (was: Proposal: Dangling comma in function
Christian Schneider wrote: Named parameters - i think is very good idea. I know i would use them. I'm really not sure about the correct... -
Function arguments
Hi Group, I have a question on overloaded function. What is the best way to pass the arguments so it is easy to maintain in future if function... -
[PHP] Function arguments
Hello, If you are worried about this issue your best option is to switch to an object oriented approach. all the best Hardik Doshi wrote: -
jdeline #2
Re: max function only allows two arguments?
Put them in a list or array and sort them.
jdeline Guest
-
dempster #3
Re: max function only allows two arguments?
If you have a list (or set) of numerical values named mylist, you can get the maximum value like this:
ListGetAt(ListSort(mylist, "Numeric", "desc"),1)
-Paul
dempster Guest
-
mxstu #4
Re: max function only allows two arguments?
pglavin,
If you're using a list, take a look at the [url]http://cflib.org/udf.cfm?ID=806[/url]
function at cflib.org. It's very easy to use.
The basic concept is that you take a list of values, convert the list to an
array and use ArrayMax() to get the maximum value.
<cfset listOfValues = "12,14.3,122.6,8,19.26,4">
<cfset maxValue = ArrayMax(ListToArray(listOfValues))>
<cfoutput>#MaxValue#</cfoutput>
As an alternative you could easily create your own UDF that accepts a variable
number of parameters (instead of a single list of values).
mxstu Guest
-



Reply With Quote

