Count the number of items separately for each status in NITRO associated items column in NITRO form

Applies To: SharePoint Online

Description:

Associated Items column in NITRO form shows related items. For example, it can show milestones related to a project or tasks related to a request. It can also show aggregate values for related items like count, sum, minimum and maximum value etc.

This article describes the steps to show count of items separately based on a column value in related items (status).

Detailed Description:

In this example, we are counting related items based on their ‘Task Status’ in ‘Associated Tasks’ NITRO Associated items column.

  1. Navigate to NITRO Forms designer for the list -> Edit ‘Associated Tasks’ column settings:
  • Open ‘Aggregate’ Tab
  • Click ‘New Aggregate’ button to configure aggregate settings for ‘Not Started’ task status:

Script used in above:

var count = 0;

if (arrSelectColValues) {

    for (var i = 0; i < arrSelectColValues.length; i++) {

        if (arrSelectColValues[i] == “Not Started”) {

            count++;

        }

    }

}

return count;

  •  Click ‘New Aggregate’ button to configure aggregate settings for ‘In Progress’ task status:

Script used in above:

var count = 0;

if (arrSelectColValues) {

    for (var i = 0; i < arrSelectColValues.length; i++) {

        if (arrSelectColValues[i] == “In Progress”) {

            count++;

        }

    }

}

return count;

  • Configure ‘Completed’ task similar to above two steps by changing the status value in script.
  1. Apply column settings -> Publish the NITRO Forms.

Sample Output: