Get multiple pages of data in Bridge
Hi all I just wanted to pass along a pro-tip that I got from the Technical Engineering group at ENGAGE 23.
If you need to deal with paged data in Bridge, it's not immediately obvious how to do that. At least not to me :-) So I asked.
For example, if you do a List Sheets in Bridge, you may get some of the data back on page 1, but the results may tell you that you have 5 pages of data to go. How do you get the next page without hard-coding page numbers into multiple Get Sheet modules?
The answer is: Child Workflow index
When you call a Child Workflow, each time the workflow runs it identifies an index number for that run, starting with index=0 for the first run. You can leverage that for your paging like this:
- Do your List Sheets, primarily to get the total number of pages. For List Sheets that reference is {{states.startstate.smartsheet.list_sheets.sheets.totalPages}}
- Call a Child Workflow, and set the Number of Runs to the totalPages reference
- On the first child workflow run (Page 1), the index will be 0. That index is part of the trigger data on the child workflow. The index reference is {{runtime.index}}
- Setup your Child Workflow to increment the index by 1 using the Math:Add module. The Add value is 1. The Number value is {{runtime.index}}. Your resulting reference will be {{states.startstate.maths.add}}. For the first run (Index 0) this value will be 1.
- Add the List Sheets module after the Math module in your child workflow. In Page Number put {{states.startstate.maths.add}}.
Using this setup, the parent workflow will call the child to run for as many pages of data as you have in the original results. Then the child will run once for each page, asking for the page number in increments of 1 each time it runs, and will return to you the results for that page.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 413 Global Discussions
- 221 Industry Talk
- 459 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 461 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives