User Manual

10.04.2024

MANUAL

Developer Function: Server Script: items.Average

## Overview This is the "Average Method" of the "[Items Object](/en/manual/server-script-items)". It calculates the average value by specifying the target table and numerical value column. ## Limitations 1. Cannot be used for anything other than "「Numerical Value Column」". ## Syntax ``` items.Average(siteId, columnName, view) ``` ## Parameters |Parameter|Type|Required|Overview| |:----------|:----------|:---:|:---------------------------| |siteId|object|Yes|Specify the site ID of the target table| |columnName|string|Yes|Specify the numerical value column to be aggregated| |view|string|No|Specify the conditions for the records to be selected| ## Return Value Return the average value of the specified numerical value column as a decimal type. ## Usage Example 1 The following example returns the average value of NumA (NumA) for all records in the table with site ID 2. ##### JavaScript ``` let average = items.Average(2, 'NumA'); ``` ## Usage Example 2 The following example selects only the records in the table with site ID 2 whose Status is 900 (completed) and returns the average value of NumA (NumA). ##### JavaScript ``` let view = { "View": { "ColumnFilterHash": { "Status": "[\"900\"]" } } }; let average = items.Average(2, 'NumA', JSON.stringify(view)); context.Log(average); ``` ## Notes This is a method used in "[Server Script](/en/manual/table-management-server-script)". It cannot be used in "[Script](/en/manual/table-management-script)". ## Related Information <div id="ManualList"><ul><li><a href="/en/manual/table-management-script">Table Management: Script</a><span>08.13.2024 up</span></li> <li><a href="/en/manual/table-management-server-script">Table Management: Server Script</a><span>08.13.2024 up</span></li></ul></article> <ul><li><a href="/en/manual/server-script-items">Developer Function: Server Scripts: items</a><span>08.14.2024 up</span></li></ul></article></div><input id="SearchTextHidden" type="hidden" value="" />
TOP
このページをシェアする
記載された商品名、各製品名は各社の登録商標または商標です。 © Implem Inc.