Can I change primary field of a table

So, I have primary field in Airtable called “SN” as a formula that concatenates text with autonumber field.
When I imported Airtable base to baserow, it ignored the formula field and the autonumber field, and now the primary field (first row on the left) is another field called “notes” which is irrelevant and not a good representation of what this row is about. So, I recreated the formula and wanted to make it the primary field but failed to do it. I also tried to change the primary field with any other text field but also failed to find a way.

is it possible to enable formulas to be primary fields and is it possible to change primary fields at all?

The whole goal of this is that when the row is linked to another table, I want to see this primary field which represents the serial number of the row.

Hey @mahmouds12 , Allowing formula fields as primary fields is being worked on and should be in the next release of Baserow. You can track the progress using this issue: Primary field cannot be formula (#859) · Issues · Bram Wiepjes / baserow · GitLab

4 Likes

Thank you
What about changing primary field after the table is created?

Right now you have to edit the primary field itself and change it’s field type and data. There is no way of making a different existing field primary.

3 Likes

I was able to do it from postgres

  • First I created the formula field as needed inside baserow
  • I connected to the postgres db and located the formula field inside “database_field” table, and set “primary” to true,
  • Then I removed it from the original primary field… then refreshed baserow ui and it worked :slight_smile:
1 Like

Hey-hey @mahmouds12! Now it’s possible to set up a Primary field as the Formula field type.

1 Like

can you tell me where you found the postgres db. I’m assuming it was in the “postgres” folder?

Despite having two databases, that folder is empty!

Hey @Cirsten,

It would depend on how you have Baserow installed, did you point it a Postgres database or are you using an all in one image?

all one image

I’m not sure how to point to a PG DB, there isn’t an option in the GUI that I could see

It is done as an env option, you can find examples below. One of them is for using an external Postgres db.

https://baserow.io/docs/installation/install-with-docker

1 Like