Store each api query response in array

Hey team!

I'm bringing in data via Calendly's API to display on the calendar component, but their 'get all scheduled events' endpoint is missing the invitee's data, so I'm unable to display the invitee's name on the calendar event. Annoying :man_facepalming:t3:

My solution so far is to loop through the get all response and then trigger an additional query for each event to get its invitees. This is working so far:

GET_scheduled_events.data.collection.forEach(x => GET_calendar_event_invitees.trigger({additionalScope: {dynamic_uri:_.replace(x.uri,"https://api.calendly.com/scheduled_events/","")}} )
)

Screenshot 2023-12-11 at 9.34.40 AM


My thinking was to create an empty array in a variable called eventDetailsArray and push each response to that with the following code:

eventDetailsArray.push(GET_calendar_event_invitees.data.collection['0'])

And I can't figure out why this isn't working...

Any help debugging this would be greatly appreciated! I'm by no means a developer so have probably missed some really obvious solutions :sweat_smile:

Thanks in advance!

Without seeing the detail my first thoughts are that if eventDetailsArray is the name of your retool variable then you'll need to update its value with setValue not push

eg along these lines of logic:

// get the current value of our data array variable
let currentValue = eventDetailsArray.value;
// modify it to have the new entry
currentValue.push(mynewdata);
// save it to the variable
eventDetailsArray.setValue(currentValue);

There's other ways of doing this but for readability and maintainability this might be a good option.

Thanks so much for this @dcartlidge! That worked beautifully.

1 Like