[API] Troubleshooting differences in number of rows returned
Who is this article for?API Users experiencing issues with query results.
API access is required.
When consuming data from the API, you might compare the results of your query with the content of a data grid in the application UI and find that the number of rows shown differs.
This article describes some factors that cause this issue.
1. Pre-filters and on-grid filters
The desktop UI allows for two kinds of filtering, and both cause rows to be hidden from view.
Pre-filters located above the data grid (accessed by clicking the grey bar) are used to exclude data from queries to the database.
On-grid filters are applied to data that has already been returned by the service and are used to hide that data from view.
Whenever either of these is used, you will see:
- the data grid header displaying count of records, showing the number visible and total.
- the columns used for filtering.
- on-grid filters with a highlighted filter icon.
2. User permissions
User role permissions affect the data that is visible to an end user, and so a user might not be able to see the entire data set.
This affects the human users and also the user account that is allocated to the API.
When doing this comparison, be sure that the application user and the API user both have comparable permissions.
3. Column selections causing different joins
The data grid is highly customisable, and users can save their own views. It is possible therefore that one user landing on e.g. the Action Tracker screen will see a different set of columns, filters (and therefore rows) to another user.
As a result of this, each user's data grid may show a different number of rows.
As a very simple example, a data grid containing some Findings might show 10 rows:
But then adding the Findings > Actions > Action column, to show child Actions, where there are multiple Actions per Finding, will increase the number of rows and cause duplication of the Finding names, in order to account for the parent Finding for each unique Action.
This means that, if comparing a UI data grid to an API data set, it is essential to ensure that you are comparing data sets made up of exactly the same columns, and that these columns come from the same parent paths.
Otherwise, differences in the joins used by the two requests will cause unequal numbers of rows to appear.