I would like to create a Favorites
behavior that bookmarks table items. Ideally there would be an action where the user could check (for example) a star icon for any item he/she would like to add to his/her list of favorites. There would be some indication that the star had been selected. Then that list could be called up at any time from some filtered slice view in the menu. Iโm assuming this would be a user sign in app. Is there a most common practice for designing this feature in Appsheet apps?
You may or may not need [_THISROW] depending on where these expressions are used. You also can use a lookup method of youโre using user UID like you should be, vs user emailsโฆ
Disclaimer all this was sent from my phoneโฆ
I guess I should have +Gary Pinter added you
2 Questions come to mind. If 100 users favorite a particular item, wouldnโt it be better to have a separate Favorites table, that contains referenced Item IDs and USERMAILs? Also, would one be able to unfavorite or deselect a starred item from the table?
+Gary Pinter mehโฆ Not in my opinion, itโs not important table worthy informationโฆ Also, I would anchor the action to a virtual column. .
What would be the purpose of anchoring to a virtual column?
youtube.com - Starred action Starred action
Ok, I get it! Thanks, man.
Iโm stoked!
Do you have the sample app to show?
I would also love to see a sample app that shows this in practice
Please can someone post a sample app for this. This is a really hand setup and it make it easier for to replicate in my app if I could see it in action.
Boom. You make one action with an empty star, and one action with a solid starโฆ
You add a physical column to your table called โstarredโ type enumlist.
The โempty starred actionโ when clicked concatenates the USEREMAIL with the starred column. CONCATENATE([starred], ", ", USEREMAIL()) show if condition in that action needs to check if the user is not in the list. NOT(IN(USEREMAIL(), [_THISROW].[starred]))
Then you want the filled in star to show up if they are in the listโฆ Soโฆ That action is the opposite show ifโฆ
IN(USEREMAIL(), [_THISROW].[starred])
And the condition for this action removes their name from the listโฆ SUBSTITUTE([_THISROW].[starred], USEREMAIL(), โโ)
That's really cool solution and (more important) it works!! But..
I did build the app on gsheet and it has a delay before it change the state. When pressing "like" it takes few second before "state" of action will change to "unlike" (in my opinion it's time that appsheet need to writes email value in gsheet cell but I could be wrong). When pressing "unlike" there is no delays.
But if I display column value in appsheet it's changing without delays. Is there a possibility to use value from appsheet not from gsheet ? Any ideas ?
+Gary Pinter yep, pretty legitโฆ An anchor column is only required in the table view. I find the deck view the most versatileโฆ
@MultiTech_Visions youโre the man
You are the Boss. I got everything working except the expression to remove it from the list: SUBSTITUTE([_THISROW].[starred], USEREMAIL(), โโ)
I tried it with and without [_THISROW]., but under set this column to this value I still get the error
โParameter 1 of the function SUBSTITUTE is of the wrong type.โ The column type is enumlist as you specified. Iโm not sure what else could be wrong
Try wrapping it in a text expressionโฆ
SUBSTITUTE(TEXT([_THISROW].[starred]), USEREMAIL(), โโ)
I forgot, substitution is a text expression
No itโs you whoโs the man! @Grant_Stead answering this question like a boss!!
Tap tap taparoo. I was freaking great
Ok, it worked somewhat. It cleared the entire record, not just current USEREMAIL
I got it, removed the [_THISROW]. WOrks perfectly!
Thanks you guys. Iโm so happy!!! Now for the slice, should I use the lookup function?
+Gary Pinter use the exact same condition for the show if in the solid star
Iโm done! Thanks Grant. I hope others find your solution useful as well. I didnโt find this functionality in any of the sample apps
+Gary Pinter sweet dealโฆ Iโm glad it came together for you. Early on itโs hard to find the right answers, and this one is pretty solidโฆ
The answer, I would think, is Yes, you could use USERSETTINGS to track a List of items selected as favorite.
Keep in mind that USERSETTINGS are device specific. If the user accesses the app from a different device, they will need to start over in selection of their favorites. For a public app where there is no login, this is probably acceptable and expected.
User | Count |
---|---|
15 | |
12 | |
9 | |
8 | |
4 |