Is it possible for min() to return the smallest value based on more than two fields?

883
2
10-06-2016 02:50 AM
CarmelConnolly3
Occasional Contributor II

Is it possible for min() to return the smallest value based on more than two fields?

In our survey, multiple health and safety assessments of issues are collected for one site. Each assessment has a due date for a resolution of the issue. For analysis of the feature service in Web AppBuilder (charting/timeslider), I've created a new field in the survey that'll shows the earliest due date from the multuple due dates filled out in the survey. This calculation is then applied using the min() formula:

min(${DueDate1},${DueDate2},${DueDate3},${DueDate4}})

But what I've found is that this only ever takes the first 2 due dates into consideration and it ignores the other fields.

Is this just how min() works or do I need to add in an extra step?

Thanks!

Carmel

Tags (2)
0 Kudos
2 Replies
JamesTedrick
Esri Esteemed Contributor

Currently, min() only supports the comparison of two values.  You could achieve what are trying to do using a set of nested min functions:

min( min(${DueDate1},${DueDate2}) , min(${DueDate3},${DueDate4}) )

CarmelConnolly3
Occasional Contributor II

Awesome, thanks James! I had 10 Due Dates so eventually managed it with:

min(min(min(min(${DueDate1},${DueDate2}),min(${DueDate3},${DueDate4})),min(min(${DueDate5},${DueDate6}),min(${DueDate7},${DueDate8}))),min(${DueDate9},${DueDate10}))

0 Kudos