totalCount error on grid for user input form

Certified Senior Developer

Trying to run a process that displays a user input form (esc_viewOnHoldAccounts). The data displayed comes from a pv! in the process called onHoldAccounts. Every time this form is set to display, I get a version of the following error.

Error Evaluating UI Expression Expression evaluation error in rule 'esc_viewonholdaccounts' at function a!gridField [line 30]: A grid component [label=“”] 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 6 and the largest column data array had 7 items.

The variable, pv!onHoldAccounts contains 6 records.  How does it come up with 7 items?

I’ve seen similar errors reported on the Forum but not that matches mine. The closest version was someone who got a similar error

A grid component [label=“”] 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."

/* Data Inputs are: button (text) and onHoldAccounts (any type) */
load(
  local!pagingInfo: a!pagingInfo(startIndex: 1, batchSize: 10, sort: a!sortInfo(field:"aipCode", ascending: true())),
  with(
    local!onHoldAccounts: a!queryEntity(
      entity: cons!ESC_ACCOUNT_DETAILED_V_DS,
      query:a!query(
        selection: a!querySelection(
          columns:{
            a!queryColumn(field:"aipCode"),
            a!queryColumn(field:"aipName"),
            a!queryColumn(field:"accountNum"),
            a!queryColumn(field:"fiId")
          }
        ),
        logicalExpression: a!queryLogicalExpression(
          operator: "AND",
          filters:{
            a!queryFilter(field: "fiId", operator:"IN", value:ri!onHoldAccounts.fiId),
            a!queryFilter(field: "accountNum", operator: "IN", value: ri!onHoldAccounts.accountNum)
          }
        ),
        pagingInfo:local!pagingInfo
      )
    ),
    a!formLayout(
      label: "View On Hold Accounts for " &today(),
      firstColumnContents: {
        a!sectionLayout(
          firstColumnContents: {
            a!gridField(
              columns:{
                a!gridTextColumn(label: "AIP Code", field: "aipCode", alignment: "CENTER", data: index(local!onHoldAccounts.data, "aipCode", {})),
                a!gridTextColumn(label: "AIP Name", field: "aipName", data: index(local!onHoldAccounts.data, "aipName", {})),
                a!gridTextColumn(label: "Routing Number", field: "fiId", data: index(local!onHoldAccounts.data, "fiId", {})),
                a!gridTextColumn(label: "Account Number", field: "accountNum", data: index(local!onHoldAccounts.data, "accountNum", {})),
              },
              totalCount: local!onHoldAccounts.totalCount,
              value: local!pagingInfo,
              saveInto: local!pagingInfo
            )
          }
        )
        
      },
      buttons: a!buttonLayout(
        primaryButtons: {
          a!buttonWidgetSubmit(
            label: "Update Accounts",
            style: "PRIMARY",
            value: "update",
            saveInto: ri!button
          )
        },
        secondaryButtons: {
          a!buttonWidgetSubmit(
            label: cons!ESC_DISPLAY_BUTTON_LABEL_CLOSE,
            skipValidation: true,
            value: cons!ESC_DISPLAY_BUTTON_LABEL_CLOSE,
            confirmMessage: "Are you sure you want to close?  You cannot re-generate payments until accounts have been updated.  If you close, you can pick this task back up in your task list.",            saveInto: ri!button
          )
        }
      )
    )
  )
)

The solution he used was to include this if statement for defining the totalCount:

totalCount: if(local!datasubset.totalCount=0,1,local!datasubset.totalCount),

This won’t work for me if I don’t have a ‘zero’count. See attached for SAIL code.

Any suggestions?

  Discussion posts and replies are publicly visible