How do I increment the value of a column using an automation

I want to increment the value of a number column in a table (among other things) using an automation event.

I’m assuming the ModifyTable formula is what I would use here. This is the example in the docs for using it: ModifyRows(Tasks.filter(Status != “Done”), Status, “Done”)

When I try to use something like this: ModifyRows(Tasks.filter(Status != “Done”), Count, Count+1), it doesn’t work.

However, this will work: MModifyRows(Tasks.filter(Status != “Done”), Count, 10)

Any help on how I can get this done?

Dear @Rahul_Jaisheel,

Please see the screenshots for inspiration:

image

Then I created the simple button just to add a row as below:

Then create an automation rule to push the button every day at a certain time as in the screenshot:

And as you can see, everyday the automation is executed;
image

I hope I have put you in the right direction :bulb:

Success,
//JP

Hey Rahul_Jaisheel!

The issues is that ModifyRows is not “at” any particular row, and you are assuming it is. ModifyRows is likely just trying to apply a value to the reduced set made by your filter, by filling a whole column with the value you set, such as “10”. When you say “Count”, which “Count” do you mean?

We need to think of a way of making sure ModifyRow was only looking at a single row at a time. For this, FormulaMap is the solution:

Tasks.Filter(Status!="Done").FormulaMap(ModifyRows(CurrentValue,Count,Count+1))

To demonstrate the function I used a button, but I see no reason this won’t work in an automation event.

PS - Ignore the type error given in the formula. Coda devs are working through this.

Lloyd

5 Likes

Impressive input :+1: thanks sharing your know-how. :handshake:

2 Likes

Hi @Lloyd_Montgomery,

Thanks for your suggestion, this does what I want it to do. The “Count” I was referring to was just the name of a column, just like you have used it.

I had made a button column in the table to increment the Count column of ‘thisRow’. I then made the automation event click this button row. This works, but having a single formula is certainly a more elegant solution.

1 Like

Hi @Rahul_Jaisheel,

A button in the row itself makes this a lot easier, and works for most situations. I recommend this for most custom solutions :slight_smile: Happy you figured out something for you, and that you also like the formula I propose.

Lloyd