DISPLAYING REPLIER TO IMAGE

Hello all. I thought this would be easier than itโ€™s turning out to be. I have three tables: IMAGES, REPLIES and LIKES. Iโ€™ve referenced (REPLIES[Replier]) with no issues. Iโ€™d like [Replier] in LIKES to also display the IMAGE of [Replier]. For some reason it keeps defaulting to the current userโ€™s IMAGE. 

IMAGES (key=Email / label=Image) 

REPLIES: (key=id / label=Reply)

[Reply] Typeโ†’Text, Initial valueโ†’blank 

[Replier] Typeโ†’Ref (IMAGES), Initial valueโ†’Useremail() 


LIKES (key=id / label=Like)

[Reply] Typeโ†’Ref (REPLIES), Initial valueโ†’Any(Replies[Reply]) Note: not sure if โ€œInitial valueโ€ is best but it seems to work for now.

Apparent problem ๐Ÿ‘‡

[Replier] Typeโ†’Ref (IMAGES), Initial valueโ†’???  Note: Iโ€™d like to display the replierโ€™s Image, but itโ€™s defaulting to the current userโ€™s email. 

Any thoughts? 
Appreciate all feedback.

Thank You. 

0 6 112
6 REPLIES 6

You have noted that [Replier] is a Ref column and it is a Ref to the IMAGES table?  Ref columns MUST ALWAYS be assigned the row key of the referenced table.  Period.

In the IMAGES table, set the [Image] column as the Label for that table.  It will show where-ever you are displaying the Replier.  You are allowed to set one data column and one image to construct the label value.

 

SIDE NOTE:


@dreamerdan wrote:

Replier] Typeโ†’Ref (IMAGES), Initial valueโ†’Useremail() 


By the orange part above, I assume you are using the login email as the row key?  I would not recommend.  Users can and do change their emails which mean a NEW key in your table.  If that happens a user loses all of their past info.  Instead use a dedicate uniqueid as they key and let login email be just a normal column.  Then email can change as frequently as the user needs to and will never lose the history in the app.

 

Hi, I do have "Email" as "id" in the IMAGES table. Even if I make the key "id" I get the same results. I guess I should emphasize that I would like to display the Image of the user who posted the topic instead of the current user.  To achieve that Should I have anything in the "Initial Value" of the "Replier" column of LIKES? Something like Any(Images[Email])? since the refence is to IMAGES? 

Thanks for the tip on making Initial value "ID" instead of "useremail()". But in a system where a user's email is required for sign in, wouldn't they need to update it anyway in order to access their account? You seem to be saying that anything they did under the old Email would be lost if they change to a new one? If that's the case, I'm wondering why many online seem to suggest that while ID is the best key in any table, EMAIL is also a good choice since it is always unique.

Thanks for the input. 

  

 

Based on the Email be used as the row key in the IMAGES table, the Replier column's Initial Value should be set to USEREMAIL()

Make sure you are not inserting the expression into the App Formula property.  This will change the row value anytime an edit is made - which you don't want.

If you have the Image column set as the label in your IMAGES table, then it will be the Image that is displayed - even though the email is stored as the value for the column.  This is because AppSheet will automatically inspect the Ref column row and use the Label as the display value.


I put it in the "Initial Value", but it's not working.

Thanks anyway for your input. 

You put what in "Initial Value"?

Exactly what is not working? 

Can you show some images of what you have been trying and what the results are?  Lots of times an image wil translate your meaning better than words do.

I put the useremail() in "Initial Value" as you suggested and not in the App formula property. Everything else is as we discussed: The reference to IMAGES from my LIKES table is not displaying the replier's image. It's defaulting back to the current App user. 

I'll keep researching and working on it. I could just be overlooking something simple.

Thanks again! 
 

Top Labels in this Space