I am using a!queryProcessAnalytics to fetch data from a portal report with a group context.

#queryProcessAnalytics I am using a!queryProcessAnalytics to fetch data from a portal report with a group context. I am wondering if there is a way to add a user context (and a process model context) to the report after it has already been created? In the last query filter below marked "HERE", I am returning all users in a selected group using fn!distictusers, and trying to filter the data within the a!queryProcessAnalytics based on the users in that group. It is not working because it throws an error "All “data” arrays must not contain more items than the specified “batchSize”, but “batchSize” was 25 and the largest column data array had 26 items". It works in some lower environments but not all, which makes me think its a data issue. Does anyone have any ideas on how to fix this?

a!queryProcessAnalytics(
report: local!portalReportId,
contextGroups: local!selectedDepartment,
query: a!query(
...

OriginalPostID-193213

  Discussion posts and replies are publicly visible

  • ... pagingInfo: local!pagingInfo,
    logicalExpression: a!queryLogicalExpression(
    operator: "AND",
    filters: {
    if(
    isnull(
    local!titleSearch
    ),
    {},
    a!queryFilter(
    field: local!COL_IDX_TASK_NAME,
    operator: "includes",
    value: local!titleSearch
    )
    ),
    if(
    isnull(
    local!statusFilter
    ),
    {},
    a!queryFilter(
    field: local!COL_IDX_TASK_STATUS,
    operator: "=",
    value: local!statusFilter
    )
    ),
    if(
    isnull(
    local!assignedToFilter
    ),
    {},
    a!queryFilter(
    field: local!COL_IDX_TASK_ASSIGNED_TO,
    ...
  • ... operator: "=",
    value: local!assignedToFilter
    )
    ),
    if(
    isnull(
    local!priorityFilter
    ),
    {},
    a!queryFilter(
    field: local!COL_IDX_TASK_PRIORITY,
    operator: "=",
    value: local!priorityFilter
    )
    ),
    /*Must be a ** Process Model*/
    a!queryFilter(
    field: local!PROCESS_MODEL_NAME,
    operator: "starts with",
    value: "BW CMPO"
    ),
    /*Not be a pause request model*/
    a!queryFilter(
    field: local!COL_IDX_TASK_NAME,
    operator: "Not Includes",
    value: "Resume"
    ),
    /*Not be a ** model*/
    a!queryFilter(
    field: local!COL_IDX_TASK_NAME,
    ...
  • ... operator: "Not Includes",
    value: "Paus"
    ),
    /*Not be a random user input task model*/
    a!queryFilter(
    field: local!COL_IDX_TASK_NAME,
    operator: "Not Includes",
    value: "User Input"
    )
    /*HERE*/
    a!queryFilter(
    field: local!COL_IDX_TASK_ASSIGNED_TO,
    operator: "in",
    value:fn!getdistinctusers(
    fn!topeople(
    local!selectedDepartment
    )
    )
    )
    }
    )
    )
    )
  • When I change the operator to "not in", data will display, but when I use "in" operator it returns the error.
  • 0
    Certified Lead Developer
    The error suggests the problem actually lies in a gridField component. Can you share more of your expression?
  • Thank you Tim for your assistance,

    Grid Field:
    a!gridField(
    label: "First Task Grid",
    labelPosition: "COLLAPSED",
    totalCount: local!datasubset.totalCount,
    columns: rule!columnsForReassignGrids(
    datasubset: local!datasubset,
    COL_IDX_TASK_ASSIGNED_TO: local!COL_IDX_TASK_ASSIGNED_TO,
    COL_IDX_TASK_NAME: local!COL_IDX_TASK_NAME,
    ),
    value: local!pagingInfo,
    saveInto: local!pagingInfo
    )

    Contents of Columns:

    {
    a!gridTextColumn(
    label: "Task Name",
    field: ri!COL_IDX_TASK_NAME,
    data: if(
    ri!datasubset.totalCount = 0,
    {},
    index(
    ri!datasubset.data,
    ri!COL_IDX_TASK_NAME
    )
    )
    ),
    a!gridTextColumn(
    label: "Assigned To",
    field: ri!COL_IDX_TASK_ASSIGNED_TO,
    data: if(
    ri!datasubset.totalCount = 0,
    {},
    apply(
    rule!prepareAppianUserDisplayNameById,
    index(
    ri!datasubset.data,
    ri!COL_IDX_TASK_ASSIGNED_TO
    )
    )
    )
    )
    }
  • 0
    Certified Lead Developer
    Could one of you fields contain a value that is actually a multiple? The indexing of a particular field may be returning more values than expected.
  • Thank you Tim, I dont believe so, but I will double check.
  • 0
    Certified Lead Developer
    So your task assigned to is the most likely culprit, check the data to see if one of your tasks is assigned to multiple people. Also you can clean up your data attributes by using the index function as follows:
    index(local!datasubset.data, cons!my_field_name, {})
    With this you don't need to test the value of totalCount
  • @mattj As said by @tim.clarke, the culprit here is mostly the task assigned to. To the best of my knowledge, the array could have been flattened which is causing you the mismatch in the data held by the columns.

    The way how we do generally in this case is as follows, we will apply the function on each record in the datasubset, rather than a field in it.

    Example:
    apply(
    \trule!prepareAppianUserDisplayNameById,
    \tri!datasubset.data,
    \tri!COL_IDX_TASK_ASSIGNED_TO
    )

    where the rule!prepareAppianUserDisplayNameById on each record found in the ri!datasubset and ri!COL_IDX_TASK_ASSIGNED_TO acts as the context. And this approach hasn't caused any problems to us till date and we can also stay away from array flattening issues.


    An other way of overcoming this issue is to ensure that the data being passed to an function isn't flattened (we can use fn!touniformstring() to prevent the array from being flattened) when each field (for instance, task assignees) in a record is able to hold more than one value.