How to chain calls in a loop where the values used are from the response to the first call

Here is the code snippet I am trying to move over from Katalon to Postman and I am having trouble to find a way to chain the calls in a loop.

I have been able to chain one call when the cardinality is one-one, but not for one-many.

Here is a sample of the test I am trying to replicate:

Blockquote
…
String token = jsonResponse.data.userProviderLogin.token
response = WS.sendRequest(findTestObject(‘tachi/query/providers_filter_only_id’, [(‘env_url’) : GlobalVariable.env_url, (‘token’) : token]))
def jsonResponse2 = jsonSlurper.parseText(response.getResponseText())
int count = jsonResponse2.data.providers.size()
if (count > 0) {
for (def index : (0…count - 1)) {
int provider_id = Integer.parseInt(jsonResponse2.data.providers[index].id)
response = WS.sendRequest(findTestObject(‘tachi/query/totalVisits’, [(‘env_url’) : GlobalVariable.env_url, (‘token’) : token
, (‘provider_id’) : provider_id]))
def jsonResponse3 = jsonSlurper.parseText(response.getResponseText())
int visits_count = jsonResponse3.data.totalVisits.total
assert visits_count >= 0
}
}

Here is my list of methods in Postman, without the looping figured out:

use postman.setNextRequest() for defining a workflow.
Refer: https://learning.postman.com/docs/postman/collection-runs/building-workflows/