Initial value to be the previous value of adjacent column

I want the initial value of a form value to equal the previous value of the adjacent column.
The formula would look like this R[-1]C[1] but this can’t be entered for initial value. How do i do this?

I could create another column which has this value but it seems overkill.

Cheers
Steven

There are [_THISROW_BEFORE] and [_THISROW_AFTER] variables. You might see if you can use the [_THISROW_BEFORE].[Adjacent_Column] in the initial value of your problem column.

I have never used these in a Form view, so I am not certain if they are available there.

If that doesn’t work, I don’t see any way you can get around using another column.

I believe these are only available in workflow expressions.

Row and column adjacency really isn’t a thing with AppSheet, so best to reconsider your requirement. It sounds to me that you want the initial value of some column–let’s call it ColumnA–to come from a different column–ColumnB–of the previous most-recently-added row. Set the Initial value expression for ColumnA to something like this:

ANY(
  SELECT(
    MyTable[ColumnB],
    ([_ROWNUMBER] = MAX(MyTable[_ROWNUMBER]))
  )
)

[_ROWNUMBER] refers to a row’s number in the spreadsheet. Assuming the rows in your spreadsheet are added in chronological order, oldest at the top and newest at the bottom, the newest row will have the highest row number. MyTable[_ROWNUMBER] (replace MyTable with the name of your table) gives a list of row numbers in your table.

See also:





3 Likes

Yeah, I wasn’t sure and didn’t have time to check myself. Maybe a feature request?

Good point! I wasn’t thinking in sheet terms. I was assuming editing of an existing row.

1 Like

Nice one. This worked just fine. Thanks you very much indeed.

1 Like