Skip to content

items.Max

Overview

This is the "Max Method" of the "items Object". It gets the maximum value of the target numeric value column in the specified table. You can specify selection conditions to narrow down the records to be aggregated.

Limitations

  1. Cannot be used for anything other than "Numeric Value Column".

Syntax

items.Max(siteId, columnName, view)

Parameters

Parameter Type Required Description
siteId object Yes Specify the site ID of the target table
columnName string Yes Specify the numerical value column to be calculated
view string No Specify the conditions for the records to be selected

Return Value

Return the maximum value of the specified numeric value column in the target table.

Usage Example 1

The following example gets the maximum value of NumA in the record registered in the table with site ID of 2.

JavaScript
let max = items.Max(2, 'NumA');

Usage Example 2

The following example gets the maximum value of NumA in the record whose Status is 200 (running) in the table with site ID 2.

JavaScript
let view = {
    "View": {
        "ColumnFilterHash": {
            "Status": "[\"200\"]"
        }
    }
};
let max = items.Max(2, 'NumA', JSON.stringify(view));
context.Log(max);