Applies to: SharePoint Online and Onprem
Description:
This article describes the steps to configure aggregate function in the NITRO Associated Items column using ‘Advanced’ operator with an example.
Sample use case
In this article, ‘Associated Tasks’ is a NITRO Associated Items column in Tickets list. We have configured aggregate settings with ‘Advanced’ operator to count child items separately based on the value selected in their ‘Task Status’ column. Choice options of ‘Task Status’ column in the associated list are: ‘Not Started’, ‘In Progress’, and ‘Completed’.
Detailed steps
- To configure the aggregate settings, navigate to NITRO Forms designer for the Tickets list -> Select ‘Associated Tasks’ associated items column -> Click ‘Edit’ button from column settings panel -> Open ‘Aggregates’ tab -> Click ‘New Aggregate’ button.
2. Specify ‘Display Text’, select ‘Task Status’ column, select ‘Advanced’ operator from the ‘Aggregate Function’ drop-down, and specify custom JavaScript in the advanced function.
Aggregate setting for “Not Started” task status:
Example to configure aggregate function using ‘Advanced’ operator in NITRO Associated Items column in NITRO Forms
Aggregate setting for “In Progress” task status:
Aggregate setting for “Completed” task status:
Script:
var count = 0;
if (arrSelectColValues) {
for (var i = 0; i < arrSelectColValues.length; i++) {
if (arrSelectColValues[i] == "Not Started") {
count++;
}
}
}
return count;
Note:
- For “In Progress” task status, configure a new aggregate and replace “Not Started” with “In Progress” in the above script.
- For “Completed” task status, configure a new aggregate and replace “Not Started” with “Completed” in the above script.
3. Publish the NITRO Forms.
Sample Output: