This is what I would like to do. I am trying weeks already but I do not find the way.
I have a list of read-only products. Each product has een favourite icon (star or heart). When I click this icon the product is added to another list called โfavouriteโ and the icon turns red. When I reclick the icon the product is deleted from the favourite list and the icon turns black again.
It seems easy but I do not find anything to do this.
I would appreciate any help!
Hello @MikeeGee, welcome to our community !
Lets take this step by step, your table is โread onlyโ, but in order to have dynamic actions you need some way to store which row is a โfavoriteโ and which one isnโt, and if we canโt add another column to that table in order to store that information, it might get bumpy.
Letโs say we make another table so that each time someone clicks a row on the primary table a new row is added for recording the newly favorited row, in order to display the โfavorite iconโ in your primary table, youโre gonna need a format rule that checks between tables in order to figure out which rows in your primary tables are โfavoritesโ.
And thatโs no bueno, cross table format rules can make your app quite slow.
What do you say then, can we add a new column to your primary table?
Also, are โfavoritesโ global (shared across all users) or should be different for each? Considering you have a Current_User system of course, and if you donโt, you should, itโs great.
EDIT: Now that i think about it we could add a virtual column to the read-only table for checking if each row is a โfavoriteโ or not, that could work.
I would like to make the favourites global for all users
Youโve got all the necessary pieces, you just need to assemble them.
Create an action that creates the โfavorite recordโ in the background
Create a Current_User system
Create an additional slice, to hold all the favorite records from the Current User
INDEX(Current_User[UserID], 1) = [Favorite_User_Ref]
IN([Favorite_User_Ref], Current_User[UserID])
IN([Primary_Record_ID], Current_User_Favorites[Favorite_Primary_Ref])
It can seem counter-intuitive to create all this โstuffโ - all this overhead - just for some formatting rules; but in reality youโre creating ways to efficiently achieve your desired results.
This action should have a condition formula, that checks to see if the record at hand is inside that Current_User_Favorites (slice).
IN()
formula (only reversed):NOT(IN([Primary_Record_ID], Current_User_Favorites[Favorite_Primary_Ref]))
Ok, let me try this. Iโll let you know when I have any questions.
Sorry but I need to do it step by step, starting with step 1.
Can you tell me if my columns are correctly filled and what do have to fill exactly in the action.
I appreciate a lot that you try to help me. Please be patient with me cause I am just een beginner
Can you give me an example? because I m really lost. I do not know what I have to fill in this new table.
maybe you can give me a sample of something like that
Rafael, are you looking for ? Or do I have to look at somewere else ?
Hello, weโre going the virtual column route then? or weโre gonna add another column to your main table? the result is similar but the methods are quite different.
If the favorites are global, then adding another column will suffice, if you wish to follow the great @MultiTech_Visions advice, which will turn your app into a much more robust one, youโre going to need to add couple more tables to your app.
Are you familiar with references and slices? those are very important for making optimal apps.
Hello! Of course I want to follow the great @MultiTech_Visions advice! Can you reach my main googlesheet (test) ? Can you use it to make an example? The problem is that I do not know how to make the specific right link between the tables. I could make some references with slices following some tutorials on youtube but I didnโt found what I searching for. Keep in mind that Iโm just a beginner I need to understand how it works and I tryed already many many many times.
I gotchu
I made some changes to the spreadsheet to better illustrate how it works, but as i was about to start explaining it I realized it would be easier if i build it myself and then make it a public sample so you can see for yourself how it works, so give me a bit of time and iโll be back with it.
Hello Rafael,
Thanks for you answer! Add a virtual column looks likes to be the right way. I use to try many times but I do not know how to do it. Below the link to my google sheet. This is just a test sheet. The first tab is a imported data and do not have to be changed. I use a quey formula to copy the data to the tab โproductsโ.
https://docs.google.com/spreadsheets/d/1tMuRCXyZiJqJHbWopJysaLw7-EKtlTMuRDS3Wokz0Ow/edit?usp=sharing
Iโm back
https://www.appsheet.com/portfolio/1902178
Itโs the only app on my portfolio, so it shouldnโt be hard to find haha, I tried to keep it as minimalistic as possible.
The sample app has:
Tables:
Slices:
Actions:
Format rules:
Expressions:
Let me know if you have any questions about it, donโt forget you can make a copy of it so you can play with it. Have fun !
Amazing! It looks different than what I thought but I like it even more! Great job! Iโam very glad. I didnโt look in detail, Iโll get time to understand how you builded up and let you know if a have questions. Thank a lot Rafael!
Iโm back with 2 questions:
1/ How do you set the ID numbers ? Is it possible to generate these numbers automatically ?
2/ How to watch the favourites in a primary view ?
Hello again
They are generated automatically already, using uniqueID():
Thereโs a slice of your primary table that contains only the favourites, you only need to create a new view that uses that slice.
User | Count |
---|---|
44 | |
31 | |
29 | |
14 | |
14 |