Skip to main content


         This documentation site is for previous versions. Visit our new documentation site for current releases.      
 

getListCount(dataViewName, payload, context)

Updated on July 20, 2021

Obtains the number of records in a data view.

Returns

The number of records as a Promise.

Parameters

NameTypeDescriptionRequired
dataViewNamestringThe name of the data view that contains the records whose count must be obtained.
payloadobjectA query object containing the details of list of columns and filter conditions.
contextstringThe name of the context where the API is being called.

The following table contains the properties of the payload object:

NameTypeDescriptionRequired
queryobjectA command to obtain a set of fields satisfying specific conditions, such as, select, sortBy, filter, etc.
Note: This property is applicable only when the Allow API query checkbox is enabled in the data page rule form.
pagingobjectAn object that obtains a specific number of records from a page.
Note: This property is applicable only when the Allow API query checkbox is enabled in the data page rule form.
dataViewParametersobjectAn object whose parameters are configured on the data view or data page.
Note: This property must be provided when the data page has required parameters.

Usage example

In this example, the API retrieves the number of records of employees whose gender is Female and whose role is Finance.

const dataViewName = "D_EmployeeList";
const payLoad = {
 "dataViewParameters": {
   "dept": "HR"
 },
"query": {
 "distinctResultsOnly": true,
  "filter": {
    "filterConditions": {
      "F1": {
        "comparator": "EQ",
        "ignoreCase": true,
        "lhs": {
          "field": "Role"
        },
        "rhs": {
          "value": "Finance"
        }
      },
     "F2": {
        "comparator": "EQ",
        "ignoreCase": true,
        "lhs": {
          "field": "Gender"
        },
        "rhs": {
          "value": "Female"
        }
      }
    },
    "logic": "F1 AND F2"
  }
  "select": [
    {
      "field": "pyID"
    }
  ]
 }
};
const context = "app/primary_1";
PCore.getDataApiUtils().getListCount(dataViewName, payload, context)
.then(response => {
 //The response of this API is as shown below:
 {
   fetchDateTime: "2020-06-29T11:06:23.896Z"
   hasMoreResults: false
   resultCount: 4923
 }
})
.catch(error => {
 console.log(error);
});
  • Previous topic getDataViewMetadata(dataViewName, context)
  • Next topic updateCaseEditFieldsData(caseID, changeSet, eTag, context)

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega.com is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us