Skip to content

Commit e108939

Browse files
Create README.md
1 parent b179197 commit e108939

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Flow Actions/Data Stream/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Pagination Setup for Data Stream Integration
2+
3+
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

Comments
 (0)