I would like to create a Favorites behavior ...

(Gary P.) #1

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?

(Grant Stead) #2

Try wrapping it in a text expression…


(Grant Stead) #3

I forgot, substitution is a text expression

(Multi Tech Visions) #4

No it’s you who’s the man! @Grant_Stead answering this question like a boss!!

Tap tap taparoo. I was freaking great

(Gary P.) #5

Ok, it worked somewhat. It cleared the entire record, not just current USEREMAIL

(Gary P.) #6

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?

(Grant Stead) #7

+Gary Pinter use the exact same condition for the show if in the solid star

(Gary P.) #8

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

(Grant Stead) #9

+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…

(Grant Stead) #10

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]))

(Grant Stead) #11

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(), “”)

(Grant Stead) #12

+Gary Pinter yep, pretty legit… An anchor column is only required in the table view. I find the deck view the most versatile…

(Grant Stead) #13

@MultiTech_Visions you’re the man

(Gary P.) #14

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

(Grant Stead) #15

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…

(Grant Stead) #16

I guess I should have +Gary Pinter added you

(Gary P.) #17

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 P.) #18
(Grant Stead) #19

+Gary Pinter meh… Not in my opinion, it’s not important table worthy information… Also, I would anchor the action to a virtual column. .

(Gary P.) #20

What would be the purpose of anchoring to a virtual column?