šŸ–‹ Conditions for Edit and Delete

Sneak peak:

4 Likes

Nice one :point_up:

Just curious what didnā€™t work? I think your relate/lookup situation would work just fine to get an array of admin emails. Then set up 2 filters with an OR to check if the signed in user is the creator of the row, or the signed in user is in the array of emails from the lookup to a sheet that lists the admins.
image

Spent 8 hours rebuilding the app with this new function. I had (no kidding) 5 copy sheets for non-editable versions of sections of the app. It was so bulky and such a slow loading sheet. Especially with all kinds of scripts working on the sheet as well.

Weeks ago, I accidentally input content into a cell of one of my copy sheets (created with a =QUERY function in A1) and it made the whole sheet go blank. I didnā€™t realize it for a few minutes and Glide pulled my spreadsheet and recognized that sheet was missing and deleted dozens of components for it all over the app. It was a nightmare and ever since Iā€™ve been A) so effing careful with everything I do in my sheets and B) dying for you guys to finally release this feature.

My sheet is so much lighter now. So much faster loading. Thank you!

2 Likes

I ran into issues when trying to build a relation to the signed-in user when the page/row had actual relation to them. A true ā€œadminā€ should have access to edit anything, regardless of whether they relate to the content in some way. I canā€™t figure out how to do this, especially if you want to designate more than one admin (canā€™t know use Lookup for multiple value relations).

Edit: I think I know what you meanā€¦ basically every row would have a column (e.g. Admin column). In that column, populate it with the email address of the admin user for that row. Then, build the condition like you did above. I just donā€™t know how to do this if there are multiple admin users.

Edit2: or if you populate the row with ā€œadminā€ then do a lookup to another sheet of users to see who is ā€œadminā€ , that would only work for one user, wouldnā€™t it, since Lookups arenā€™t for multiple valuesā€¦?

Correct. Youā€™d have to build a sheet that specifies admins.

Name the columns Admin 1, Admin 2, etc. and populate those columns with email addresses. Glide will create an array column of these admins called Admin. Then you can create a filter that says if Admin is signed in user. You could get this to populate in every sheet of you create another column called IsAdmin and fill it with any string like ā€œtrueā€ or ā€œadminā€. In your other sheets create a similar template column, then do a relation/lookup of the Admin column.

1 Like

@kyleheney What Iā€™m doing in my example is what you describe in your Edit2. Have an ā€œadminā€ value in the sheet, create a multiple relation to an admins sheet that has the same ā€œadminsā€ value, then create a lookup that pulls all the admin emails. You have to make sure the admin records are in rows instead of columns. You would only have one email column in the admins sheet.

In my screenshot, Email 1 is just a single email column of the row owner. Lkup-Admins is a lookup array of multiple values from a sheet that has multiple rows.

Filtering by signed in user works great with an array created from a lookup

Iā€™ve had a problem in the past with what @Robert_Petitto is saying. I wasnā€™t able to successfully do a lookup into an array to create a super-array inside the lookup.
I havenā€™t tested this, but Iā€™m assuming this may be the issue you have had with doing a lookup into an array column on the related sheet.

1 Like

Thanks for this detail. Iā€™ll play around some more and see if I can get it working.

1 Like

Rather than fiddling with extra lookups or relations, I would just add a Single Value column to every tab I needed to filter with those admin rights, and use that Admin array as the source. You can then filter using the single value column as ā€œis signed in userā€. I just tested it for something Iā€™m working on and it seems to be working just fine.

P.S. - Regarding that Single Value column - I find myself making a tab I name GLOBAL, and use it for things Iā€™ll use in more than one spot, and use the Single Value column to bring it over to the appropriate tab. For example - besides the Admin array above, I only need to link to graphics or photos that are used over and over once. If I update it on the global tab, it updates everywhere.

1 Like

Yep! I do the same thing with global graphics. I usually put them in the same sheet with all my choice component selection items.

Me too! So happy to see this new functionality :slight_smile:

Do you mind sharing a sample sheet. Thanks

Here you go. gnjz5.glideapp.io

Iā€™m using admin rights from the tab to show buttons to submit new operations and operation updates.

1 Like

Thanks a Million @Tim_Sullivan

Thank you very much for sharing. Iā€™ve never had to use the Array Column function and had no idea the Glide editor saw those types of columns that way. That definitely makes it easier to assign multiple admins.

Glad to help.

There is a lot of power behind arrays. Once you discover them and realize you can use them for image carousel, email filtering/visibility, either end of a relation, any many other things, it opens up a whole new world.

1 Like

Definitely! This will definitely make a few things Iā€™m doing more simple and effective.

1 Like

Would be really great if we could choose from the full collection of Icons to replace that little pencil. In some cases the editing of a row of data (essentially what this is) is best communicated to the user in other ways than ā€œyou are editing thisā€. Especially in instances where a community of people all have access to edit the same row of data. Hereā€™s a use case:

Imagine a library-type app with a bunch of books in it. But you want to simulate a feel that each book only has a limited number of copies for the community to read. For each row of data, you create several columns representing how many copies of the book to check out and corresponding date columns for when they have been checked out. You use the check out dates to create a condition for when certain check out columns are free to be overwritten and hence when that little edit pencil becomes visible to everyone. Inside the edit form, you create a simple little UI and messaging that sends the next personā€™s email address and current date to overwrite the data in an avail check out column. With this new function, you can do things like this and so much moreā€¦

But a pencilā€¦ is a pencil really the best way to communicate a use case like the one Iā€™ve just described? Iā€™d love access to some stars or some hearts or some bookmarksā€¦ to all of the pro icons.

You should submit that to our Feature Requests app :wink:

1 Like