Best practice for referencing images

Could someone shed some light on the best practice for the following;

I have a read only table of category, type, image i am using as a reference table. The Garment column is a key/label and the image column is a label. It looks like the below

[Department] [Garment] [Images]
Outerwear Rainwear Garment_images/Rainwear.png

The referencing works fine, the image and label show up in my drop down lists.

But I am also trying to use an app formula to find the associated image column as an the main image for my Order Details page.

I was using a spreadsheet formula which was working but only after the sync occurred, pretty sure i can just create a VC in my order details page as show image type? or image type? I have tried a few formulas but cant seem to get the image to showโ€ฆ

Thanks for reading

Solved Solved
1 19 1,624
1 ACCEPTED SOLUTION

You need a column (real or virtual) of Image type in the child Table. Set itโ€™s App Formula to
[whatever your parent ID is].[image column]

Then you can set it in views.

EDIT: virtual is probably best if it is possible to change the parent image and you want any and all children to also reference new image.

View solution in original post

19 REPLIES 19

Steve
Participant V

3X_1_9_194249a459e272fefaa8a8fa6c025a7f74ab54ae.png

HI Steve,

I didnโ€™t explain myself to well there,

When i create a child record for an order, this child record is a โ€˜productโ€™ type record that allows the user to select the โ€˜garmentโ€™ type, so thats working fine by referencing the โ€˜garmentโ€™ table that has text and image as labels. But i also want to set this child recordโ€™s main image as the same one that is being referenced

I have a folder named Garment_images within the same folder that has my spreadsheet on Gdrive.
I have the spreadsheet tab for the child records that has an image column, inside the image column cells i have the image file name value as per your link. ie: Garment_images/Tshirt.png

So far i have been using an array-formula in this image column in the child record spreadsheet, the array-formula just finds the Garment type and concatenates the file name value to build the correct value, obviously this is not ideal as the app cannot see that cell and hence display the image until it syncs the child record.

Im thinking there is a better way of doing this by using an appformula so that i can have the garment image show up immediately

I cant set the Image column to a Ref type, because the inline details view will not display ref as an image,
If i use a spreadsheet formula the app doesnโ€™t recognize the image until after a sync,
I cant use a appsheet formula such as SELECT as that seems to want to find values and they donโ€™t return as an image,

There should be a way of doing this as the app can already see these images in the referenced table, any other ideas?

You need a column (real or virtual) of Image type in the child Table. Set itโ€™s App Formula to
[whatever your parent ID is].[image column]

Then you can set it in views.

EDIT: virtual is probably best if it is possible to change the parent image and you want any and all children to also reference new image.

Do you have an example of this? If I have a Parent Table called Main_Table with the following columns: uniqueID, Name, image. The child Table is called Photos_Table with the followinng columns: PhotoID, Photo.
Following your instructions:
[whatever your parent ID is].[image column]

If I enter the following expression into the child table Photos_Table image column: [uniqueID].[image]

I get the following error:
Unable to find column โ€˜uniqueIDโ€™, did you mean โ€˜PhotosIDโ€™?

I am pretty new to Appsheet and my goal is to store all the images into the child table and reference them into the parent table to be viewable in the cards or deck view. Unfortunately, as the original poster mentioned, โ€œI canโ€™t set the Image column to a Ref type, because the inline details view will not display ref as an image,โ€ which is I assume the reason why my image ref type does not load in the card compared to using a a standard image Type.

Do you have a step by step that I can follow?

It sounds like you first need to learn more about how references work:

Thanks for the link. I read that as well as the links within the article. I am starting to familiarize myself with references but I am still trying to wrap my head around your syntax. I understand that once you create a ref from the parent to the child, that appsheet auto creates a hidden column called modified main_table with the expression REF_ROWS(โ€œMain_Tableโ€, โ€œImageโ€).
Is this what you are referring to?

My main problem is that when the parent references the child image column, the image within the parent Main_Table card disappears. If I donโ€™t use a ref type, the image type works fine and shows up in the cards, as expected. However, I want to pull the images from the Photo Table. I just donโ€™t understand why a ref type cannot be displayed as an image? I was hoping your expression would help that problem.
Any ideas?

Not hidden, and โ€œRelatedโ€ฆโ€ not โ€œmodifiedโ€.

I wasnโ€™t referring to anything. I just thought you needed more knowledge about references based on what you wrote earlier.

  1. You donโ€™t reference columns, you reference records.
  2. Typically, it is the child that is referencing the parent, so you may be thinking in reverse here.

Itโ€™s still not clear exactly what youโ€™re doing. For further help, Iโ€™d suggest attaching screenshots of your setup.

Here is the table data. I did notice that for the โ€œNew Listโ€ viewer uses โ€œPhotoโ€ for main image while the Main_Table parent vieweruses โ€œAutoโ€ but does not have any other options other than โ€œnoneโ€. I am assuming that this is beacuse it cannot read the data from the reference?






In your case, the [whatever your parent ID is] is currently your [Image] column.

Therefore, I should enter the following expression into the child table Photos_Table image column: [image].[image]

I still get an error. Should I be using REF_ROWS? What is the correct syntax for my case? Thanks

3X_2_4_240c44b4e72764d45a900a0b17058444c125ca78.png

Main_Table is your โ€œchildโ€ Table in this case.

Now thats confusing. I thought that since the photos are located within the Photos_Table, that Main_Table would ref to Photos?
Where would the expression go then and what would that expression be?
Would you be so kind as to write a step by step for me as I have been working on this for the past 3 days. Thanks in advance.

Typically, we call the Table with the Ref type column the โ€œchildโ€, and the Table with the REF_ROWS() VC the โ€œparentโ€.

To translate the above for your situation:
You need a VC in Main_Table, with the expression:
[Image].[Photo]

Wow. That actually works. Thank you so much!!!

To summarize,
Here are the steps to make this work based on your direction:

a) I have two tables: Main_Table & Photo_Table, where Photo_Table contains all the images.

b) In Main_Table, the โ€œImageโ€ column or record, is set to REF. The REF is connected to Photo_Table Photo.

c) In Main_Table, a Virtual Column (VC) is created and set to type image. Inside the Formula is an expression containing: [Image].[Photo]

BEFORE:

SETUP:


RESULT:

Google Sheet Data:
Table_Main Sheet:
3X_a_5_a5af842a7bce792a9183d3565130288d6d743598.png

Photo_Table Sheet:
3X_9_1_913cf173cbf04b3f0a918c5beb4fba89f40b9c4b.png

Works!

In another post, someone recommended turning ON โ€œLabelโ€. Why would this be a recommendation?

I am certainly glad this works, However, I am curious as to why a direct ref would not see an image? The fact that you have to use a Virtual Column as a middleman to call the images is confusing especially since referencing all other non-image data does not need a VC.

The Row Label is what is shown in the app for a referenced record, instead of the recordโ€™s key value. Setting the image as the label would allow the user to see the image from the Main_Table Detail view, but that still doesnโ€™t make it available as an image to select in the Deck view of Main_Table. Any column settings in a UX have to be columns in the actual Table.

A reference, at its simplest, is the key value of one record being held in a column of another record. There is no โ€œseeingโ€ of anything. Your statement of โ€œsince referencing all other non-image data does not need a VCโ€ is wrong.

Main_Table is not referenced by anything, so setting itโ€™s Row Label isnโ€™t accomplishing anything here. And the reason it would default back to OFF is probably because you already had a column set as the Label, youโ€™d need to turn it off at the same time as turning another one on.

Very informative responses. Thank you for your time. I have learned a great deal from you.

Thats the one!, I was dereferencing it using the wrong key, thanks so much

Haskell_F
Participant III

Essentially, Main_Table is trying to reproduce what you see in the โ€œNew Viewโ€ but with referenced images. But the ref images just dont show up. I checked to make sure that the image folders exist.

Haskell_F
Participant III

It Looks like when I turn Label ON for Photo within Photo_Table, it displays the photos instead of just the names. That is nice.

BEFORE:

AFTER:

If I try to turn Label ON for Image within Main_Table and save, it defaults back to OFF. I guess maybe because of the virtual column?

Top Labels in this Space