GeorgeBramhall1
Qrew Member
2 years ago

Query that determines the Maximum number in a set of records.

Is it possible to create query that results in the maximum value for a set of records? I see SumValues and Size, but no Maximum.

------------------------------
George Bramhall
------------------------------

8 Replies

• There should be Max function.

Hope this helps.

------------------------------
Bibhav Rimal
------------------------------
• Not sure how I would use the Max function in a Query formula.

------------------------------
George Bramhall
------------------------------
• The formula queries do not currently support Min or Max. The exception to that is that the Quarry results of returns and record ID sequence so if you happen to want to know the men or max of the record ID eight then there is a way to purse that out.

I do know that there is a Jinja Syntax that you can use in the Pipeline when you search a set of records it can return the highest and lowest value. I'm not the expert on that syntax but if that's useful we could try to figure that one out.

------------------------------
mark.shnier@gmail.com
------------------------------
• So while this has resulted in a bit of showing off knowledge for other purposes, the simple answer is that it cannot be done (as of July 2023).

If only Quickbase had a Formula that accepted a "Max" argument as a delimiter-separated string instead of multiple arguments.  There is not way to turn a string such as "1; 2; 4; 10" into multiple argument for the Max function to process.

There is a way to pull this off in a Pipeline, but no way to run a Query for max and no way to determine max in a Formula Field.

• If you're working with a small or predictable data set, you can cheat this with the following snippet. You can extend it to support as many potential input values as you want.

I wouldn't blindly condone using this, but if it works, it works.

``````//debug = 9;10;11, or your query result converted to string

var number a = ToNumber(Part([debug],1,";"));
var number b = ToNumber(Part([debug],2,";"));
var number c = ToNumber(Part([debug],3,";"));

Max(\$a, \$b, \$c)

//result = 11``````

------------------------------
gary
------------------------------