Jul 23, 2024 03:43 PM
I’m currently working on a setup where I need to reference data from the previous record in my Airtable base. Specifically, I want to pull data from fields in the previous entry to use in calculations for the current record.
Here’s what I’m trying to achieve:
I have a field called Current Tank Level in each record.
I want to automatically populate a field called Previous Tank Level in the current record with the value from Current Tank Level of the previous record.
I’ve tried setting up linked records and using rollup fields, but I'm facing challenges with automating the process to ensure the Previous Tank Level field always reflects the correct value from the previous record.
How am I able to grab the previous record entry "Tank Level value" and automatically add it to my "Previous Tank Level" record?
Jul 23, 2024 04:18 PM
Hiya, I think you're on the right track with the linked record.
Make a link field to the same table. You can title this "Previous Data". Make a Lookup field that shows the specific fields you want to display. This is the "Previous Tank Level".
I'd probably unselect the option to link multiple records in the link field. Otherwise, you can end up with multiple entries in the "Previous Tank Level" field.
Here's a screenshot of what I mean:
Let me know if this helps 🙂
Jul 23, 2024 05:00 PM
Can you think of away to use an automation to select the previous record?
Jul 23, 2024 06:21 PM
This may depend on how you are labeling the records. If you have the records auto numbered then you may be able to set up an automation that when a record is created.
Create the formula field "Previous Level ID" here is the formula: ID-1 This will get the previous entry ID number.
Then you will set up the automation where when a record is created it searches for records matching the previous ID. Then it updates the linked field "Previous Level Entry" with the matching search. Having the lookup field for the previous level should make everything happen you were asking for.
Here are some screenshots. If you have any questions feel free to ask.