Display Multiple Columns in Dropdown Fields

Hello,

I currently have a table storing a unique number and an associated project name in separate columns. I’d like to create a form with a dropdown menu that will list both the names and the unique IDs as the names will occasionally be similar enough to need the number to differentiate.

The CONCAT function doesn’t seem to work with Retool, is there something obvious that I’m missing here or will I need a Transformer script to do this.

Thanks!

Easiest solution is to concat the columns in your database query before it gets into retool.

1 Like

Hi there! Byron’s suggestion above is great and probably the easiest. If you do want to go the transformer route, your transformer could look something like this:

const tableData = {{ table1.data }}
return tableData.map(row => {
  const idString = row.id?.toString()
  return idString?.concat('  ', row.name)
})

Here we’re converting the id (which might be an integer) to a string, then concatenating with to the name of the project. To reference the value of the transformer, in your dropdown’s value field, you would do {{ transformer1.value }}