# Displaying name instead of ID for relation

Let's review the case when you need to display a value in the table instead of a foreign key field from a related table.\
For example, you have Users and Orders tables that both have the *User id* field. So instead of displaying just the user id, you can display the *user name* value for convenience.

Here's how you can do that:point\_down:

1. Select the *Orders* table and click on the *User id* column to open its settings.
2. Change the default type of the field (Number) to *Select/Tag* in the *Type* dropdown.
3. Now, in the *Options* field below, switch to the JS mode, and specify the following code:

```javascript
return {{actions.loadUsers.data}}
  .map(user => {
    return { 
      value: user.id,
      title: user.first_name
    }
  });
```

<figure><img src="/files/sSroyNTLLWijLWzmy5rY" alt=""><figcaption></figcaption></figure>

This code maps the *first name* value from the Users table to the *user id* value from the Orders table.

That's it! Now, you'll see users names displayed instead of their ids.

<figure><img src="/files/vfIPdVn9Y8NEeRn9BYLJ" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.uibakery.io/reference/working-with-components/table/more-ways-to-use-the-component/display-a-name-instead-of-id-for-relation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
