Category: How do I do X?


This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How can I display in a select widget values that have some similarities?


I am trying to display a select widget to pick an employee from my PostgresDB table, but I am facing an error due to duplicate values for name and surname. How can I solve this issue?


The problem mentioned is that the select widget is returning an error due to duplicate values found for properties that must be unique. This is because there are employees with the same surname and name in the table. To solve this problem, we can use the user_id column, which is unique, as the value in the label-value pair, and the name and surname columns as the label.

For example, we can use the following code to map the data from the QueryName object and create an array of objects with the label and value properties:

{{ => {return { "label": + ' ' + item.surname, "value": item["user_id"]}})}}

This code creates an array of objects, where each object contains a label and a value property. The label is the concatenation of the name and surname columns, and the value is the user_id column.

By using this approach, we can display a select where the options are unique, based on the user_id column, and still show the employee's name and surname as the label.