4D v14.3

Max

Home

 
4D v14.3
Max

Max 


 

Max ( series ) -> Function result 
Parameter Type   Description
series  Field, Array in Data for which to return the maximum value
Function result  Real in Maximum value in series

Max returns the maximum value in series. If series is an indexed field, the index is used to find the maximum value.

You can pass an array (one or two dimensions) in series. In this case, the array must be of the Integer, Longint or Real type.

If the series selection is empty, Max returns 0.

If the command is correctly executed, the OK system variable is set to 1. If it is interrupted (for example if the user clicks on the Stop button of the progress thermometer), the OK variable is set to 0.

The following example is an object method for the variable vMax placed in the break 0 portion of the form. The variable is printed at the end of the report. The object method assigns the maximum value of the field to the variable, which is then printed in the last break of the report.

 vMax:=Max([Employees] Salary)

The following method is called to print the records in the selection and to activate break processing:

 ALL RECORDS([Employees])
 ORDER BY([Employees];[Employees]LastNm;>)
 BREAK LEVEL(1)
 ACCUMULATE([Employees]Salary)
 FORM SET OUTPUT([Employees];"PrintForm")
 PRINT SELECTION([Employees])

Note: The parameter to the BREAK LEVEL command should be equal to the number of breaks in your report. For more information about break processing, refer to the chapter Printing.

This example gets the highest value in the array:

 ARRAY REAL($ArrGrades;0)
 QUERY([Exams];[Exams]Exam_Date=!01/07/11!)
 SELECTION TO ARRAY([Exams]Exam_Grade;$ArrGrades)
 vMax:=Max($ArrGrades)

 
PROPERTIES 

Product: 4D
Theme: On a Series
Number: 3

The OK variable is changed by the command

 
HISTORY 

Modified: 4D v11 SQL Release 3
Modified: 4D v13

 
SEE ALSO 

Min

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v13.5)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)

Inherited from : Max ( 4D v12.4)