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
Add pagination setup code-snippet for Data Stream integration (#1110)
* Add pagination setup script for Data Stream integration
- Created a script to handle pagination for Data Stream integrations.
- The script calculates the next offset based on the limit and total number of records.
- It determines whether to make an additional API call for the next page of results or stop.
- This script is useful for managing large datasets in paginated API requests.
* Create README.md
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