Favorites Components

Hi!

I added two favorite components that toggles from visibility based on if a user favorited a certain business but it doesn’t seem to be working correctly. In some instances, it doesn’t show up, in others, the favoriting seems to be a bit delayed. I click ‘Add to Favorites’ and it doesn’t change to Favorited, or takes a while to, but when I unfavorite it, it doesn’t change back to Add to Favorites.

You can see it’s not even showing up here, it should be above the ‘Share this Business’ text.

This is how I have the visibility set up for "Add to Favorites’ component and vice versa for the Favorited component.
fav123

Thanks!

Are you testing in Glide’s environment? Try in your mobile phone

I did it for both, and having the same issue.

Try setting the visibility condition to “is not true”

Its showing up faded and not clickable.

Like so:

When a component is greyed out like that, it usually means that it has no column to write to.
Check the configuration on the component, and make sure the target column exists, and there is at least one row in the destination table.

Other than that, I’m not sure what the problem could be.

1 Like

Yes, there is a favorites column.

Does it matter if there are favorite checkboxes in empty rows?

Have you ever deleted a rowID column from that Sheet?

The Row ID is an array formula from the main sheet.

I think it requires a Row ID Column to work. Try it

The thing is that will add a new set of Row IDs and I need for them to be the same as the main sheet. This is an public sheet created from an array from a main (private) sheet.

Jen - is this the sheet that I helped you set up?

The “RowID” that you’re pulling in via the arrayformula isn’t really a true RowID column in the Glide sense. It’s just a copy of the RowID’s from another sheet. If you edit the column, I expect that you’ll find that it is a “Text” column type.

What I would suggest is renaming that column to “UserID” or “BusinessOwnerID”, and then add a “proper” RowID column - ie. one that is a RowID type.

These Row ID will be different, no? I need for them to be the same as there are instances in the app the Row ID in the public sheet and private sheet are being compared to pull data.

You can pull the data using that column you brought over, that’s not a problem. The favorites can be tied to a whole new rowID column that is the true rowID of that specific sheet.

2 Likes

Just be aware that when you start using formulas that pull data from other sheets, the number and order of rows can fluctuate without Glide’s knowledge, and the true Row ID column WILL eventually become out of sync from the data that is being pulled in via a formula. You may favorite one business today, then delete a different business from the source sheet, which reorders the data in the copied sheet. All of a sudden your favorite on one business is now on a different business, because in Glide’s eyes, the true row id used for favorites didn’t change, but the associated business for that true row id changed in the copied sheet.

In situations like this, I recommend using scripts to fill the second sheet, but only let the script copy over the data without ever altering the order of existing rows in the second sheet. It would have to check for existing businesses ID’s and Add, Update, Delete as necessary. Don’t ever do a straight carbon copy of the data and let a business potentially get detached from the true Row ID it was assigned by glide in the second sheet. It will look good now, but will absolutely break later and you’ll spend too much time trying to figure out why.

3 Likes

Ok, so using a new set of Row IDs on this public sheet won’t have an affect on other parts of the app which utilize the private sheet row ID?

Definitely don’t want that to happen. Thank you!

Is there a script template for that? Kind of how I used a template for the array formula.

Hi Jeff, Would this be the correct script?

function copyMasterCalendar() {
  var source = SpreadsheetApp.getActiveSpreadsheet(),
      sheet = source.getSheetByName('Pictorial Calendar'),
      destination = SpreadsheetApp.openById("1exiUWVypFpYeHMkXHO3sMUTGupiC2gQjZIF0Ss44-pU"),
      destSheet = destination.getSheetByName('Pictorial Calendar'),
      copydSheet = sheet.copyTo(destination);
  copydSheet.getDataRange().copyTo(destSheet.getDataRange());
  destination.deleteSheet(copydSheet);
}
``

Also, would this break my app since I am changing the data and headers?
Last time, I had to change this sheet from lookups to excel arrays as I have now and it cleared all my components. I had rebuild my entire app. Thanks!