Copy data from the previous row

I have a GlideApp that I store, among other things, locationFrom and LocationTo as selection columns…

How do I use data from the LocationTo column as a preselected in the LocationFrom column on a new row when LocationFrom and LocationTo are a Selection column?

The following idea might sound a little convoluted, but you could do the following:

  1. Number your rows in ascending order, either manually or automatically. Try manually first.
  2. Then create a math column on row n to show (n-1).
  3. Create a relation from row n to row (n-1) using the value (n-1). Now row n is “pointing” to row (n-1).
  4. With a lookup, pull the values in row (n-1) and display them in row n. This way values from one row are shown in another.

If this rows are not consecutive, adapt as needed. That would be the basic idea: create a relation followed by a lookup.

Hi,

Thanks for the reply. I have tried something similar but the challenge seems to be that the field I should have preselected is a selection field.

1 Like

When you say pre-selected, I assume a default value that you can edit?

Would it always be the value from the last row in the database?

1 Like

I probably don’t need to change the field.

Yes it will be from the last row. It is a logbook where I log voyages for which I want the last PlaceTo as preselected as PlaceFrom in the next row. Now that I think about it, I might drop the Selection function on that field. Maybe that will make the task easier.

I have a similar function on the hour counter and total log, and they work.

Then you just need to:

  • Create a single value column that grabs the last “PlaceTo” value in your user profiles table.
  • Use that as a special value in your form for the next record, writing to the “PlaceFrom” column.
1 Like

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