Reset Multiple Rows At Once

There have been several requests for people to find a way to clear a value in multiple rows. I was thinking about that and came up with a quick example of a way to handle that. Instead of trying to clear a value in an entire column, I realized we could just change one value on a parent column, load it as a single value in our sheet and then compare that parent value to a column that we set or unset for each row. It’s not about clearing an entire column, it’s about making a value in each row not equal to a value in a single parent row. Then you can use an IF/Then column to determine if the ID in the single value column equals the ID set in a column for each row. Using a relation you can bring all selected values back to the parent. Easier to show than explain, so here is a simple example.

This probably won’t work in certain cases, like Add/Edit/Form mode, but if you build it on a detail screen it works great.

BONUS: If you create a Math column, fill it with today’s date, and format it to show date only, then you could create a template column that takes that math column and “locks in” the date formatting. That template column could replace the ParentID column and instead of saving an ID into each task row, you would save the date into each task. This way you could have tasks that would automatically reset at midnight.


Edit: Here is a more advanced version that allows for an option to Select/Deselect All tasks at once. This version feels overly complicated for what it is, but it works. I also added an option to add new tasks, and if ‘Select All’ is selected, the new task will be added as unselected and the ‘Select All’ checkbox will become unchecked. I did discover a bug when adding a new task, where it appears to activate the action on the list item and it was setting the ParentID on the new task, even though my Add Row action wasn’t setting that column value at all. I can only assume that the list action gets triggered. To get around it, I added a Set Column action to clear the ParentID column after the row is added. Feel free to play with it. All Tasks are shared among all users, but task selections are unique to each user.


Edit 2: @Roldy took this a step further and added the ability to save your selections as a preset and later reload any of those saved presets. Here is the link to his post and sample app.

36 Likes

Great job! I used a very similar approach to “approve” multiple rows at once (i.e. change a boolean to true on multiple rows at once). I decided to abandon it though because I could only get it to work if everything was approved in order — I had the “last” single value determine the values above it. It works great, but if there were ever a row that needed to not be approved, I couldn’t find a reliable way to make it work properly and be dynamic enough to work in all possible workflows for the users.

2 Likes

Hmm, so basically a Select All / De-select All with the ability to override individual items? I might have to play around with that idea. I wonder if it would work with setting ID’s instead of booleans. Would probably require setting timestamps as well and checking if the timestamp of a ‘select all’ or the timestamp of and individual item should take precedence. Might get overly complicated, but I might have to give it a shot. Maybe it wouldn’t be too bad.

1 Like

Yes! This is an excellent alternative to the time stamp solution I showcase here:

Or really here:

3 Likes

I spent a while on it and thought I was getting somewhere by checking the last entry and the 2nd last entry… But then what if the 3rd last entry wasn’t true too… It gave me a headache haha

Basically, a user submits a row for approval. They may submit multiple rows before the previous ones are approved. Manager goes in and see all the unapproved items. They’re given the option to approve each one individually (checkbox inline list) or press an “approve all” button if they’re all ready to be approved.

The logic I created was working until someone approved something out of order, or if a previous submission should not be approved. Setting the “last” entry to approved should not affect the unapproved row in that case, but should affect the other unapproved rows. The timestamp idea brings in some new options in my head though.

2 Likes

@Robert_Petitto Timestamp is a good solution too. Maybe you actually planted the seed in my head. :wink: I think I initially considered timestamps to begin with, but for whatever reason I settled on a unique id instead.

@kyleheney I think I understand what you are saying. I’ll see what I can build into my concept app. May be a couple days. We’ll see.

3 Likes

@kyleheney I think I figured it out. Although it’s quite ugly to implement.

4 Likes

Oooo…the “select all” is a nice touch.

1 Like

Ooo this looks promising! I’ll have to dig deeper into tomorrow when I’ve got some time. Thanks for looking into this!

1 Like

That’s really really good, Jeff! Thanks for sharing

1 Like

I will say that it’s still glitchy and there is definitely a glide bug somewhere. I noticed that when other users add a task to the list, it is firing the list’s action for everybody else and marks the task as selected for everybody else. That’s the part I thought I fixed by clearing the ParentID through a Set Column action after the row was added. Apparently the “fix” (workaround) only applies for the same user adding the row. The only time ParentID should get set is when you tap on a list item, but somehow it still happens when a new list item is added and it appears on other user devices.

2 Likes

Hola @Jeff_Hager,

I have been one of those that have tried to find a solution and an explanation for months. @Robert_Petitto carried out a similar solution weeks ago and both are fine!

But the problem source keeps intact: why can’t any Set Column action work with a multiple relation? :upside_down_face:

Using SQL terms, we just need a SQL UPDATE Statement to get it

UPDATE table_name
SET column1 = value1, column2 = value2, column3 = value3 ...
WHERE condition

The table_name and condition are part of a Glide’s relation and columns and values are parameters of any Set Column action, everything is here.

If we can get it, we can update any inventory easily as well after a sale operation when any APP uses the Joint List column to create its List Items associated to an order.

Saludos, feliz noche!

.

6 Likes

Because that hasn’t been released as a feature (yet) :wink:

But yeah, lots of us have been asking for this, and it certainly makes sense. So hopefully it’s somewhere in the Glide backlog (and not buried too deeply) :slightly_smiling_face:

1 Like

Working very well :star_struck:

Link Easy Doctor · Glide · Create Apps from Google Sheets | Loom

9 Likes

haha… your apps always look so slick! :+1:

3 Likes

haha… thank you @Darren_Murphy :facepunch: :grin:

Ditto! I wish I knew a tenth as much CSS haha

Btw, I’m just using CSS to get this gradient effect, because I feel it was too much white space lol

So, basically, only here :stuck_out_tongue_winking_eye:

image

4 Likes

That’s the part (or one of) we’re talking about! SO cool!

1 Like

Yeah! Thank you! Gives all the charm :relaxed: