How to Use a Reference Column with Images and Another Column as Key

V-A
Silver 1
Silver 1

Using the AppSheet Workout Log app template found here, the "Workout Log" table has a column "Exercise" that references a column in the "Exercises" table with the same name.  That Workbook Log table's Exercise column is set as the table's key, as shown below.  I want to make that column editable and key columns cannot be edited per documentation.

Before changing the table's key:

VA_0-1677548169928.png

Per the docs, I've created a separate column in the spreadsheet for "Row ID" and set that as key.  This solution however prevents the images from appearing.

After setting the new "Row ID" column as key:

VA_1-1677548454374.png

Is there a workaround to have the referenced "Exercise" column displayed correctly AND use another column as that table's key?

0 9 296
9 REPLIES 9

A Ref type column's values must be from the referenced table's key column. If you changed the Exercises table's key column without changing the existing values in the Workbook Log table's Exercise column, then that's your next step.

Thanks for the reply.  I hope I understood it.  Are you saying that if I changed the Exercise table's key column that I will need to change the "Name" value of the Workbook Log table's column making the reference?  That is, making "Row ID" the key for the Exercises table and changing the name of the "Exercise" column in the Workbook Log table to "Row ID"?

If so, I tried this and the images aren't displayed.  What am I missing?

VA_0-1677555715717.png

 


@V-A wrote:

Are you saying that if I changed the Exercise table's key column that I will need to change the "Name" value of the Workbook Log table's column making the reference?


No.


@dbaum wrote:

the existing values in the Workbook Log table's Exercise column


I'm referring to the column's value in each row of the data source.

Sorry to be a bit dense on this.  Since the Workbook Log's original Exercise column was a reference to that column with the same Name, which was the key column in the Exercises table.  I'm unclear what values I should change in the data source, Exercises table's Exercise column.  Could you provide more detail or an example?

To be sure, I can change the database values for the Exercise column in the Exercises table via the spreadsheet if that's what you mean.  I'm trying to allow users of the app who may have made a typo when creating a new Exercise to make changes rather than having admin needing to make those changes for the user.

I hope this better explains the intended outcome and user experience.


@V-A wrote:

I can change the database values for the Exercise column in the Exercises table via the spreadsheet if that's what you mean


No:


@dbaum wrote:

the existing values in the Workbook Log table's Exercise column


 


@V-A wrote:

Could you provide more detail or an example?


For example:

Exercises table

Row number Row ID Exercise
1 abcd1234 Sit-up
2 wxyz6789 Push-up

Workbook Log table

Row number Exercise
1 Sit-up abcd1234
2 Push-up wxyz6789

Thanks for the reply and samples.  I got in touch with AppSheet support and a person there noticed the problem is with the template's Image column-type.  It is set as image-type when it should have been set as thumbnail-type when the app was created, according to the person.

He said that the problem was that the linked images' resolutions were too high for, I suppose, the table view-type.  Images he estimated should be no more than 200px (which is the dimension of all my linked images, for what it's worth) .

We tried several ways to try to convert the column-type (e.g. new tables, deleting and reconnecting that database, etc.) and he concluded that there's no workaround to convert the values except to (1) change the source column's column-type via the AppSheet editor and then (2) manually edit each entry via the app so that their labels match the correct image.

Though these steps worked, there may be (should be?) another way to short-circuit that process.  This process also changes the database (Google Sheets) entries under the "Exercise" column of the "Workbook Log" table to random alphanum characters (even though the it's the column-type under the Image column that was changed).  Other drawback are relatively minor.

Steve
Platinum 5
Platinum 5

@V-A wrote:

I got in touch with AppSheet support and a person there noticed the problem is with the template's Image column-type. 


That sounds entirely wrong.

That may be so, along with much of what I relayed.  Making wholesale changes of values or datatypes in a database also shouldn't have require single-entry-by-single-entry edits via the app.  Nothing else I've tried has worked so far so I'm stuck.

Top Labels in this Space