REST API Array Response > Single Object from Array Selected in List View > Update retool DB

Ok... figured this out...

  1. I added a variable called selectedFruit
  2. I added an event handler to the button within the list view container (list view shows the user a button for every container). The event handler sets a variable {{i}} (simply the number of the object within the array REMEMBER the first object in an array = 0, 2nd = 1, 3rd =2 etc)

image

  1. I then use this variable in my key value pairs within my write to retool DB query...

size >{{REST API NAME.data[selectedFruit.value].size}}
item_id >{{REST API NAME.data[selectedFruit.value].itemId}}
average_weight >{{REST API NAME.data[selectedFruit.value].averageWeight}}
colour >{{REST API NAME.data[selectedFruit.value].colour}}
price >{{REST API NAME.data[selectedFruit.value].price}}
name >{{REST API NAME.data[selectedFruit.value].name}}

1 Like