getListCount(dataViewName, payload, context)
Obtains the number of records in a data view.
Returns
The number of records as a Promise.
Parameters
Name | Type | Description | Required |
dataViewName | string | The name of the data view that contains the records whose count must be obtained. | ✅ |
payload | object | A query object containing the details of list of columns and filter conditions. | ❌ |
context | string | The name of the context where the API is being called. | ✅ |
The following table contains the properties of the payload object:
Name | Type | Description | Required |
query | object | A command to obtain a set of fields satisfying specific conditions, such as, select, sortBy, filter, etc. | ❌ |
paging | object | An object that obtains a specific number of records from a page. | ❌ |
dataViewParameters | object | An object whose parameters are configured on the data view or data page. | ❌ |
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)