Programmatically use Gallery image in other places within app?

Have a table with configuration info, where a photo is defined as one of the columns. Additional functionality was added to include a photo gallery later, using a different table. Image display order in the gallery is controlled by ‘Display Order”, as shown below. Would like to leverage the gallery photos to obtain the first photo in the list to be used in place of the current hard-coded photo in the configuration table. Tried adding a VC to the configuration table with the following expression:
“Select Photos[Photo] from Photos where Photos[Display Order] = 0.0”

Error: The expression is valid but its result type 'Yes/No' is not one of the expected types: Image

How else would you make that connection between the two tables to be able to pick an image if you know it’s displayOrder value? In my case, the value is known to be 0.0 (zero).

 

jeffminder_0-1672445677360.png

 



 

 

Solved Solved
0 10 278
2 ACCEPTED SOLUTIONS

In your original post's screenshot of the Photos table, the Row ID column is the key and the Photo column is the label. It sounds like the new column you created in the Configuration table (appropriately) returns a value from the Photos table's Row ID column. If that new column is configured as a Ref type column, then generally across your app its literal text from the Row ID  column would not be displayed and the image from the Photo column would be displayed instead. If some part of that standard design is not applicable to your situation, then you can instead explicitly retrieve the image you're seeking. For example, revise your new column's App formula expression to retrieve not the Photos table's Row ID value but rather its Photo value:

LOOKUP(MINROW(“Photos”, "Display Order”), "Photos", "Row ID", "Photo")

View solution in original post

It's unclear to me what you have done in terms of the configuration of your Configuration table and its columns. What I described (i.e., References between tables - AppSheet Help) is the standard, most robust way to implement what I'm inferring you're trying to accomplish, and in at least some circumstances can certainly be better than the alternate technique based on LOOKUP that I drafted for you. Nonetheless, that alternate technique is not necessarily problematic--especially if your dataset volume and other factors are of a size and complexity that any lag in app performance is not noticeable.

View solution in original post

10 REPLIES 10
Top Labels in this Space