No it shouldn’t. The max( function is expecting 2 or more separate parameters. The content of the DateArray parameter is one string of text. The commas within it are just characters in that one parameter, not delimiters between parameters. You wouldn’t want every string that happened to contain commas to be interpreted as multiple parameters.
No, I wouldn’t want every string with a comma interpreted as multiple parameters, but wouldn’t I want every string inside a max() function interpreted as multiple parameters?
Given how max( works, I am not sure what to expect in your hypothetical.
When I first looked at Jim’s questions, I thought, “oh, you didn’t specify the separator.” Of course, it not allowed because the max function assumes and requires a comma. But if it didn’t, the problem you pose could be trivial.
Suppose we have a new function, arraynumericmax(ArrayName, separator), which could be defined as
I meant that 3 strings of text should be compared. The first was the eight character string “one, two”. The second was the single character string “A”, and the last was the single character string “B”. If I had wanted “one” to be compared to “two” to be compared to “A” to be compared to “B”, I would have written
max("one", "two", "A", "B")
Characters inside the quotes are just characters. Delimiters between parameters will be found outside the quotes. Without that rule, I don’t have any way to tell Panorama that “one, two” is a single, eight character parameter.
I think there is some confusion about what the max( function is all about. It’s not a function for operating on arrays. It’s a function for comparing two or more discrete parameters, and returning the greatest.
In Panorama 6, it was limited to two parameters, and they both had to be numeric. In Panorama X, there can be an unlimited number of parameters, and they can be either numeric or text, but not both in the same function. Those commas are not array separators, they are delimiters between parameters.
Function parameters are evaluated independently, before the function is called. The values are passed to the function when it is called. The function only sees those values, not the expressions that were used to generate the values. The max( function isn’t going to take parameters that were passed separately and break them up into still more parameters.
Dave has left me with nothing to explain – he has done it perfectly, and everything he has said is exactly right.
There are a number of Panorama statements and functions that are designed to interpret text as a text array. The max( function is not one of them – it doesn’t know a text array from a bag of bones. If the documentation for a function or statement doesn’t specifically mention text arrays, that function or statement doesn’t support text arrays.
What @JamesCook would like is a maxnumberinarray( function. However, this function doesn’t currently exist. Dave’s formulavalue( solution may well be the best way to do this at this time. It seems very “Panorama-y” to me.
Well, quite the discussion my question inspired. I had figured the array was being see as a single parameter, and yes, a maxnumberinarray( function would do the trick.
With no such function available, David has provided the solution that I hadn’t figured out on my own and it will work just fine.