Select Component Setup with REST API

Here's the setup:

  • API endpoint which just lists out the users:

    [
    {
    "id": 2,
    "created_at": 1634683232774177,
    "firstName": "Darth",
    "lastName": "Vader",
    "email": "",
    "role": "coordinator",
    "isAdmin": true,
    "lastLogin": null
    }
    ]

I'm trying to pull in the values and the labels from the call:
image

I get the data but I can't access the .id or the .firstname

It's probably just a dumb thing but voila.

Hi @toby , have you tried using the .map() method to retrieve .id or .firstName? For your setup something like this could work:

  • Values: {{ getCoordinator.data.map(item => item.id) }}
  • Labels: {{ getCoordinator.data.map(item => item.firstName) }}

You can also check out Retool University for more docs to get unstuck: Javascript in Retool

Hope this helps?

1 Like

I haven't but might try that