Feb 12, 2020 09:24 AM
Hello everyone, I am wondering if there is a way to use the checkbox field to move lines to a new table once checked. I have a table of current inventory, I have a form linked to this inventory list so colleagues can see the inventory and request accordingly. Once the inventory is depleted I would like to just use the checkbox to trigger the line to move to a different table of depleted inventory. I have used the VIEWS function to filter the depleted inventory out of my view, but in this case the depleted inventory still will show up on the linked form that others use. I am currently just manually cutting and pasting the lines in the new table. TIA
Solved! Go to Solution.
Feb 12, 2020 09:31 AM
If you’d like it to occur exactly as you’re describing it, you’ll need the help of some sort of third party tool (integrations and/or the API) that would add/remove records as directed or the scripting block as described below.
But using vanilla Airtable, it looks like the form can limit linked records to a view. You can access these settings with an extra click on the linked record in the form configuration menu. Does that help?
Feb 12, 2020 09:31 AM
If you’d like it to occur exactly as you’re describing it, you’ll need the help of some sort of third party tool (integrations and/or the API) that would add/remove records as directed or the scripting block as described below.
But using vanilla Airtable, it looks like the form can limit linked records to a view. You can access these settings with an extra click on the linked record in the form configuration menu. Does that help?
Feb 12, 2020 11:25 AM
Hi @Daniel_Sandoval - I agree with @Zollie on this one. Limiting the view in the form is the “right” way to go. Generally, I would keep things of the same type in the same table (but adjust status or something else to indicate they are old or otherwise not needed).
That said, there is a case for archiving and with the new Scripting beta block this can be done.
This script:
let table1 = base.getTable("Table1");
let table2 = base.getTable("Table2");
let result = await table1.selectRecordsAsync();
for (let record of result.records) {
if (record.getCellValue("Move to Table2")) {
await table2.createRecordsAsync([
{
fields: {
'Name': record.getCellValue("Name")
},
}
]);
await table1.deleteRecordAsync(record.id);
}
}
will move the selected items from Table1 to Table2 when run:
I think the new scripting block is going to be really useful
JB
Feb 12, 2020 01:10 PM
This works perfect! idk how I missed that option when making the form. Thank you so much!