How to get TaskId with queryProcessAnalytics - Throwing "Grouping and aggregation are not supported. (APNX-1-4203-027)"

Below is the expression rule code being used to get TaskId based on Asset and TaskOrGroupName filters. Getting below error:

"Grouping and aggregation are not supported. (APNX-1-4203-027)"

Code:

a!queryProcessAnalytics(
report: cons!NSA_UserTasks_Report_Cons,
contextUsers: loggedInUser(),
query: a!query(
selection: a!querySelection(
columns: { a!queryColumn(field: "Asset", alis: "Asset", visible: true),
a!queryColumn(field: "TaskId", alis: "TaskId", visible: true)
}
),
logicalExpression: a!queryLogicalExpression(
operator: "AND",
filters: {
a!queryFilter(field: "Asset", operator: "=", value: ri!AssetOrProjectName),
a!queryFilter(field: "Task", operator: "includes", value: ri!TaskOrGroupName)
}
),
pagingInfo: a!pagingInfo(1,-1))
)

  Discussion posts and replies are publicly visible

  • Hi Anusha,

    a!queryProcessAnalytics() doesn't support Grouping and Aggregation. Make use of Group By column present while adding data to a Process report.

    Thanks,
    Hema
  • I have used the below code, which is never returning a task id and throws error stating the task is deleted or completed by someone. This is because a TaskId is not being returned by the below code. Please advise whats wrong with the below code and how to get a task id.

    Conditions: Filter by an asset name and also when one of report column contains a text value.

    with(
    local!dataSet: a!queryProcessAnalytics(
    report: cons!NSA_UserTasks_Report_Cons,
    contextUsers: loggedInUser()
    ),

    local!requiredColumnConfig: reject(fn!isnull, a!forEach(
    items: local!dataSet.columnConfigs,
    expression:if(index(fv!item, "label", {}) = "TaskId", index(fv!item, "field", ""),null)
    )),

    local!filterColumnConfig: reject(fn!isnull, a!forEach(
    items: local!dataSet.columnConfigs,

    expression:if(index(fv!item, "label", {}) = "Task", index(fv!item, "field", ""),null)
    )),

    local!assetColumnConfig: reject(fn!isnull, a!forEach(
    items: local!dataSet.columnConfigs,
    expression:if(index(fv!item, "label", {}) = "Asset", index(fv!item, "field", ""),null)
    )),


    a!forEach(
    items: local!dataSet.data,
    expression: if(index(fv!item,local!assetColumnConfig,"") = ri!AssetOrProjectName,
    if(
    find(ri!TaskOrGroupName, index(fv!item, tostring(local!filterColumnConfig),""), 1) = 0, false,
    index(fv!item, tostring(local!requiredColumnConfig),"")
    ),
    false)
    )

    )