I would like to create a Favorites behavior ...

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?

2 26 2,334
26 REPLIES 26

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.

Top Labels in this Space