Skip to content

items.MaxDate

Overview

This is the "MaxDate Method" of the "items Object". It gets the date value of the target date 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 "Date Column".

Syntax

items.MaxDate (siteId, columnName, view)

Parameters

Parameter Type Required Description
siteId object Yes Specify the site ID of the target table
columnName string Yes Specify the date 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 date value column in the target table.

If the specified date value column is not foundutilities.EmptyTimeis returned.

Usage Example 1

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

JavaScript
let maxDate = items.MaxDate(2, 'DateA');

Usage Example 2

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

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