Hey Awesome People, I am trying out all the p...

Hey Awesome People, I am trying out all the possibilities of AppSheet and was wondering if anyone had any experience in creating a user favorites table ?

That is, I would like an app user to be able to click a button on a list to add the item to a favorites list.

Any guidance would be very gratefully received.

Many thanks in advance. Ian

0 7 353
7 REPLIES 7

Hi Ian, I have an idea about a way you could go about doing this: 1) Create a Yes/No column in the table called โ€œfavoriteโ€ with an initial value of โ€œfalseโ€ 2) Create an action called โ€œFavoriteโ€ with the effect of โ€œData: set the value of a columnโ€ that sets โ€œfavoriteโ€ to true 3) Create a slice of the table with a row filter condition โ€œ[favorite]โ€ 4) Create a view for that slice called โ€œFavoritesโ€ Hope this helps!

I think the problem in @Vivian_Nowka-Keaneโ€™s approach (if I understood it correctly) is that all users will share the same favorites list.

Each row in the favorites table should contain the original item key, and the userโ€™s email (assuming your app requires sign in). You want to protect this table with a security filter like USEREMAIL() = [email_column_name]. This way each user will see only his favorite items and also only his email address (!). Now you can create a slice for the items table filtering only items that appear in the favorites table.

@Gil_Littman_AppSheet

This is great advice, Am I am able to implement and test this in pre-deployment mode with my own email address ?

@Ian_Coldwell Yes, you should be able to build and test it before deploying.

@Gil_Littman_AppSheet

Hi Gill, I have been trying to add this action to my app but still need a little quidanceโ€ฆ I have created a table called โ€œfavoritesโ€. I have created a slice called โ€œmy_favoritesโ€. I have added an โ€œAdd to my Favoritesโ€ action button the the detail view of the main list. So far so good ! My question is I canโ€™t seem to find the way to tell the action button to add the row ( columns item key and USEREMAIL)to create a new row in the favorites table. Can you elaborate a little more about how to configure the action ?

Many many thanks โ€ฆ I feel like I am close

@Ian_Coldwell You can set the action to go to another view in this app, and use LINKTOFORM to navigate to the right form and pre fill the the column item key. If you set the USEREMAIL to be the initial value of the email column, the user will only have to click save in that form.

Hi Ian, If you have a Yes/No column called โ€œfavoritesโ€ and a slice called โ€œmy_favoritesโ€ and you filter with an expression like

โ€œAND(USEREMAIL()=[email_col], [favorite_col])โ€, then a separate โ€œfavoritesโ€ table isnโ€™t necessary. If youโ€™re looking to add a row that is initially set to be a favorite, then you can create an โ€œAdd favoriteโ€ action that links to a form with pre-filled in values like Gil was saying.

To do this, youโ€™ll need to create a ref view of type form for that table.

The expression for the action of type โ€œApp: go to another view within this appโ€ would look something like LINKTOFORM(โ€œFormNameโ€, โ€œtrueโ€, [favorite], USEREMAIL(), [email_col], UNIQUEID(), [key_col])

Top Labels in this Space