Bring in data from the table into a new row

I have setup a new row button, with a formula to add the current date.

I would like to also bring in the one cell from the prior row.

For example, when setting goals for a day, a new row signals a new day, it would be great to bring in the previous days goal into the new row

thanks!

1 Like

Hi @Andy_Farquharson ,

Not sure I understand well yor point, but trying this : you want to add new row for a new day, and that stuff in the previous row are copied in the new one, right ?

If yes, try configuring your button this way, and the date as well as showed >

Button configuration


Date Configuration*

Live Action : The text of “Task” Column is copied to the next day
CPT2210191833-673x429

4 Likes

HI Andy,

Just some more information about the topic “prior row”.

In Coda the term prior row can be determined in three different ways.

Creation Order.
There is a field called RowId that is created when a new row is added. This is a sequential number, and the number can never be re-used. “Prior Row” in this case would then be the row created just before.

Table order
You can create row One and Row Three, and then insert Row Two afterwards between One and Three. In table order, your rows would then be One, Two, Three, but in Create Order the sequence would be One, Three, Two.

Sort Order
Tables can be sorted in any number of ways, and “Prior Row” in a sorted view would then depend on the sort rule for that view.

Because of the above, @Quentin_Morel 's suggestion to use the date is very good. People tend to create an index in docs where they want to refer to a “prior row”.

And I just thought of something as well - The problem with RowId is that when rows are deleted, that number is missing, and formulas that rely on, say, the RowId-1 to get the previous row, could look for a non-existing record. But the Creation Date for the row will still be in sequence. You could probably use a combination of the find() and nth() formulas to find the prior row. In creation sequence.

Regards
Rambling Pete

2 Likes

Hi @Piet_Strydom !

About that indeed, I wrote something I would not use my self, I thought about that after posting and told myself I needed to come back here to correct ! You’re faster than me !

In pratice, it was an example of how to autofill date, but indeed this is not stable, and there are many ways to create this id-like. Probably the best idea would be to use daily automation that would trigger the button, and add to the button the adding of the current date when it’s triggering. May be OP would like to manually push the button each day, I don’t know.
But for the main point, I fully agree with you to the fact that in the main use case, we cannot use RowId as relevant tracker !

2 Likes

thank you both for your amazing answers…what a great community!

for the date I am using a very simple function to add the date when I request the new row…this is an action I want to take.

For adding the previous days tasks, @Quentin_Morel, your example is perfect, that is exaclty what I am trying to create.

to @Piet_Strydom suggestion, date would be perfect.

2 questions;

  1. what would the formula be using date?
  2. where do i enter the formula, in the button settings or in the cell?

thanks again for your help :pray:

1 Like

I would create the column CreatedOn() that will be filled automatically, and a column to rank your row according to the CreatedOn column, something like Rank(thisRow.[Created on],thisTable.[Created on],True() )

That should replace the RowId, without missing anything

Quentin

3 Likes

Yeah, that what I had in mind

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.