Hi all,
A user got a UI expression error today that reads "[...] has an invalid value for "totalCount". "totalCount" must not be null or less than the number of items in any of the "data" arrays, but "totalCount" was 0 and the largest column data array had 1 items."
I'm unable to replicate the UI error and unable to see what could be causing it. I've been looking through the forums and have checked that when there's no data being passed in, no data should be getting generated for any of the columns. Where possible they all either index {} when null or use a foreach, which from what I've read should prevent this type of error from occurring.
I've attached the code for the grid, I apologize for the length. If anyone manages to take a look and indicate what the issue might be I'd really appreciate it.
a!gridField_19r1( spacing: "DENSE", showWhen: not( rule!CMN_isEmpty( local!datasubset ) ), label: " ", emptyGridMessage: "There are no tasks based on the selected filters.", totalCount: local!datasubset.totalCount, columns: { a!gridTextColumn( label: "Date added", field: "createdOn", data: a!forEach( index( local!datasubset, "data", {} ), rule!CMN_formatDateTime( returnDateOnly: true, dateTime: index( fv!item, "createdOn", {} ) ) ) ), a!gridTextColumn( label: "Age", field: "workitemAge", data: index( index( local!datasubset, "data", {} ), "workitemAge", {} ) ), a!gridTextColumn( label: "Work item ID", field: "workflowId", data: index( index( local!datasubset, "data", {} ), "workflowId", {} ), links: a!forEach( items: index( local!datasubset, "data", {} ), expression: if( rule!CMN_isBlank( index( index( index( ri!taskDatasubset, "data", null ), "c6", null ), wherecontains( tointeger( fv!item.workflowId ), tointeger( index( index( ri!taskDatasubset, "data", null ), "c5", null ) ) ), null ) ), "", a!processTaskLink( task: index( index( index( ri!taskDatasubset, "data", null ), "c6", null ), wherecontains( tointeger( fv!item.workflowId ), tointeger( index( index( ri!taskDatasubset, "data", null ), "c5", null ) ) ), null ) ) ) ) ), a!gridTextColumn( label: "ID", field: "aId", data: index( index( local!datasubset, "data", {} ), "aId", {} ) ), a!gridTextColumn( label: "Work item type", field: "workflowTypeLabel", data: index( index( local!datasubset, "data", {} ), "workflowTypeLabel", {} ) ), a!gridTextColumn( label: "Status", field: "workflowStatusLabel", data: index( index( local!datasubset, "data", {} ), "workflowStatusLabel", {} ) ), a!gridTextColumn( label: "Party 1", field: "partyId", data: a!forEach( items: index( index( local!datasubset, "data", {} ), "partyId", {} ), expression: rule!getCurrentPartyNameFromList( currentItem: fv!item ) ) ), a!gridTextColumn( label: "Party Name", field: "partyName", data: a!forEach( items: index( index( local!datasubset, "data", {} ), "partyName", {} ), expression: rule!getCurrentPartyNameFromList( currentItem: fv!item ) ) ), a!gridTextColumn( label: "type", field: "Type", data: a!forEach( index( local!datasubset, "data", {} ), index( fv!item, "type", {} ) ) ), a!gridTextColumn( label: "Is group?", field: "isGroupMaster", data: a!forEach( index( local!datasubset, "data", {} ), if( toboolean( index( fv!item, "isGroupMaster", {} ) ) = true, "Yes", "No" ) ) ), a!gridTextColumn( label: "Assignee", field: "currentAssignee", data: a!forEach( index( index( local!datasubset, "data", {} ), "currentAssignee", {} ), rule!CMN_formatUserName( username: fv!item ) ) ), a!gridTextColumn( label: "Decision Maker", field: "decisionMaker", data: a!forEach( index( index( local!datasubset, "data", {} ), "decisionMaker", {} ), rule!CMN_formatUserName( username: fv!item ) ) ), a!gridTextColumn( label: "Local entity", field: "localPartyName", data: a!forEach( items: index( index( local!datasubset, "data", {} ), "localPartyName", {} ), expression: rule!getCurrentPartyNameFromList( currentItem: fv!item ) ) ) }, identifiers: index( index( local!datasubset, "data", {} ), "workflowId", {} ), value: ri!gridSelection, saveInto: { ri!gridSelection, if( rule!CMN_isEmpty( ri!gridSelection.selected ), a!save( ri!selectedWorkflowObject, {} ), { a!save( local!unselectedWorkflows, difference( touniformstring( index( ri!selectedWorkflowObject, "workflowId", null ) ), touniformstring( ri!gridSelection.selected ) ) ), a!save( local!selectedWorkflows, difference( touniformstring( ri!gridSelection.selected ), touniformstring( index( ri!selectedWorkflowObject, "workflowId", null ) ) ) ), a!save( ri!selectedWorkflowObject, if( rule!CMN_isEmpty( local!unselectedWorkflows ), ri!selectedWorkflowObject, remove( ri!selectedWorkflowObject, wherecontains( local!unselectedWorkflows, touniformstring( index( ri!selectedWorkflowObject, "workflowId", null ) ) ) ) ) ), a!save( ri!selectedWorkflowObject, if( rule!CMN_isEmpty( local!selectedWorkflows ), ri!selectedWorkflowObject, append( ri!selectedWorkflowObject, index( local!datasubset.data, wherecontains( local!selectedWorkflows, touniformstring( index( local!datasubset.data, "workflowId", null ) ) ), null ) ) ) ) } ) }, selection: true(), shadeAlternateRows: true() )
Discussion posts and replies are publicly visible