Unconsistent value of a Ref

peremayol
Participant II

I am testing AppSheet with my database of coins.
The database is in several sheets of one Google Spreadsheet.
Each Mint (city) includes a Ref to one Territory (ID_Territory) where the Mint is located.
In the view for the list of mints I have grouped them by Territory, so in the group Europe you will find the Mint of Barcelona (Barcelona is in Europe ). So the Ref to Territory seems to be working very nicely.
Now comes the very strange thing happening: When I click the Barcelona Mint to get further detail on this mint in the Territory field the value Europe also should appear. But it doesnโ€™t! Another different territory appears (Asia Persica)!
Any idea what might be happening?!
Screenshot 2020-10-20 at 20.32.19|690x169
3X_a_c_ac26c5ed30a20c020ee22d952b1140f140d695f3.png

0 7 291
7 REPLIES 7

I see this is your first post! Welcome to the community!

So in your example Details view, the โ€œIDโ€ value is the correct ID for Barcelona but the โ€œID_Territoryโ€ is not correct?

Can you show how you are assigning the โ€œID_Territoryโ€ value?


Also, this article might help with the usage of Ref columns:

There is a table Territory where each row corresponds with a territory
One of this rows/territories is โ€œWestern Europeโ€
There is a table Mint where each row is a โ€œmint locationโ€
One of its fields is โ€œID_Territoryโ€ so each Mint has a Territory but a Territory can have several Mints
ID_Territory is a Ref pointing to Territory where ID is Territoryโ€™s key!


At the Mint view the Mint โ€œBarcelonaโ€ seems to be properly linked to the Territory โ€œEuropeโ€ but when I click on Barcelona and a detailed view opens thatn the Territory is different (Asia (Persica))

I think we need to compare how you are presenting the Territories in the assignment Form view with how you are displaying them in the Detail view.

For Ref columns, it is important that:

  1. In the expressions, if any, of the column you ALWAYS operate on the row key - i.e. things like SELECT() expressions always returns the row key.
  2. That in the base table (Territory in your case) that you have set the proper Label column.

The most common mistake is using a SELECT() expression in Valid_If to control the dropdown list and NOT returning the row key.

With these two important things properly set, the column should provide the proper behavior in all the views without any extra effort on your part. (NOTE: there are exceptions for unique use cases but I donโ€™t think this is one of them)


I would like to see the rest of the โ€œID_Territoryโ€ column. Specifically, the expressions, if any, for Valid_If, App Formula and Initial Value.

Second, a snapshot of the Territory table showing the columns set as the Key column and Label column.

Third, if the column in your Detail view showing the wrong Territory is different than โ€œID_Territoryโ€, then I would like to see the definition (including expressions) of that column.

3X_5_0_506e71b574817cfe71bb894cc846d659e767d0a5.png

Your setup of ID_Territory and Territory table looks correct to me.

When you click on the inline action to go to the ID_Territory details (the circle with an arrow to the far right), what does it show as the ID?

What does the sheet show for ID_Territory for the Barcelona mint?

Beyond this I would recommend contacting support@appsheet.com. They will access you app to see whatโ€™s causing the mis-match.

I solved the problem. As easy as changing all IDs (Keys) from Number type to Text typeโ€ฆ

Does each record have a unique key value?

Can you show screenshots of the views that you are clicking from?

Top Labels in this Space