Icon

07_​Modified Variables Propagation in GET Request Nested Loop

Modified Variables Propagation in GET Request Nested Loop

This workflow demostrates the use of the option "Propagate modified loop variables" available in Loop End nodes.
Given a list of search terms, the workflow iterates over each search item to avoid overloading (outer loop) and then it sends GET request to the Google Books API for each search term to get the relevant book authors and titles. The maximum results in Google Books API is 40, therefore, for each search term, the workflow repeats sending GET requests untill the starting index of an item (a book) is larger than the total number of available items for this search term (inner loop).

The workflow demonstrates the difference for external, injected, and internal variables as well as the difference between the propagation option on (in the inner loop) and off (in the outer loop).

This workflow uses Google Books API to get the titles and the authors for the books corresponding to the provided search terms.
Injected variable -Reset at each iteration -Exported after loop execution with value of last iteration
Internal variable -Reset at each iteration -Discarded after loop execution
External variable startIndex: 1. Inner loop: was modified at each iteration, its modified value was propagated to the Loop Start at each iteration and exported from the loop body. 2. Outer loop: was modified at each iteration, each iteration started with the initial value. Unmodified value was exported from the loop body. Injected variable base_url: 1. Inner loop: was modified in the loop body but wasn't propagated each time to the Loop Start and was exported modified according to the last iteration 2. Outer loop: Wasn't propagated to the loop start; unmodified value was exported. Internal variable totalItems: 1. Inner loop: was created inside the loop body, wasn't propagated to the Loop Start and wasn't exported.
External variable -Updated in the inner loop, its modified value is propagated to the inner loop start -Not propagated in the outer loop - outer loop starts each iteration with the initial value
Ungroup
Iterate over the search terms
Chunk Loop Start
Create URL with startIndex parameter
String Manipulation (Variable)
Create variable total items with total number of results available
Table Row to Variable
Create base URL for Google Books API
Variable Creator
Create variable startIndex=0
Variable Creator
Provide a list of search terms
Table Creator
increment startIndex adding number of results of this iteration
Math Formula (Variable)
Extract Table Dimension
Send request to API
GET Request
JSON Path
Table Row to Variable
Iterate result pages(max 40 results per page)
Generic Loop Start
Propagate modified loop variablesoption is enabled
Variable Condition Loop End
Propagate modified loop variablesoption is disabled
Loop End

Nodes

Extensions

Links