Hello! I have a problem. I am trying to chang...

11117
New Member

Hello! I have a problem. I am trying to change key column. Adding new virtual column with app formula =UNIQUEID(), selekt key row and deselect key roe on _RowNumber column. But after saving _RowNumber again as key columnโ€ฆ How can I fix that? The main problem is that I can not add events in my table, there is a mistake โ€œThere is already a row with the key โ€˜2โ€™โ€

0 6 2,736
6 REPLIES 6

Hi I may be wrong but I donโ€™t think you can use a virtual column for your key. You need to add a new column to your sheet for the UNIQUEID or select

a

diff column or columns (you can use two) as the key. Check out the documentation here. help.appsheet.com - What is a Key? What is a Key? help.appsheet.com

@Lynn Virtual columns can be key columns.

The problem here is that a virtual columnโ€™s App formula value is recomputed at least every time the app is synced. The UNIQUEID() function will produce a different value each time itโ€™s recomputed. Consequently, the value is โ€œunstableโ€ (i.e changing), and cannot be used as a key.

To accomplish your goal, you need to add a column to your spreadsheet in which the key will be stored for each row. A good way to do this is to copy whatever spreadsheet column is currently the key column into a new column and give the new column a new name. Then go into the AppSheet workbench and Regenerate the columns for the corresponding table, to make AppSheet aware of the new spreadsheet column. Once regenerated, mark the new column as KEY and unmark the previous one. SAVE.

Iโ€™ve tried this multiple times and itโ€™s not working. Iโ€™m getting the error message โ€œKey column โ€˜Keyโ€™ in Schema โ€˜Sheet2_Schemaโ€™ cannot use an app formula. The app formula will be removed.โ€

Hi

as Steve explained earlier,

Consequently, the value is โ€œunstableโ€ (i.e changing), and cannot be used as a key.

You can use a formula if it is in a โ€œinitial valueโ€ field, though, as it will be calculated only one time, as it is commonly done with UNIQUEID() formula.
Otherwise, there is no way to set a calculated field as a key_column.

Top Labels in this Space