You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script is used to manage pagination for a Data Stream integration in ServiceNow.
4
+
Use this script to set pagination variables or manipulate variables extracted by XPath or JSON Path.
5
+
6
+
## Code Overview
7
+
8
+
The script calculates the next offset based on the current page's limit and offset, and determines whether or not to retrieve the next page of data based on the total count of records available.
9
+
10
+
### Key Variables:
11
+
-**`limit`**: The number of records to retrieve per page.
12
+
-**`offset`**: The starting point for the next page of records.
13
+
-**`getNextPage`**: A boolean flag indicating whether to continue fetching more pages.
14
+
15
+
### How it works:
16
+
- The script compares the `nextOffset` (calculated as `currentOffset + limit`) to the total number of records (`totalCount`).
17
+
- If the `nextOffset` is less than the `totalCount`, the `getNextPage` variable is set to `true` to fetch the next page.
18
+
- If there are no more records to fetch, the `getNextPage` variable is set to `false`.
19
+
20
+
This setup is particularly useful for handling large datasets in paginated API requests, ensuring efficient and scalable data retrieval.
0 commit comments