Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Dec 03, 2021 08:18 PM
Hi All!
Can anyone provide some scripting advice - I want to create a script that changes a field type from Multiple Select to a Text field when it runs, and another script to do the reverse.
Thanks in advance for any feedback!
Dec 03, 2021 08:49 PM
Scripts cannot change the field type of an existing field. Scripting app can create new fields, but it cannot delete fields.
Why do you want to change the field type?
Dec 04, 2021 10:55 AM
Many thanks Kuovonne, I did not realize this scripting limitation… I’m creating an airtable form that would include a multiselect dropdown field, however I want it to only show drop-down options that are currently present in that table. Older items which were previously selected as drop-down option (but are no longer selected in the table) would ideally be excluded from showing as drop-down options in the form. Currently, drop-down options will show all current and previously added drop-down options unless you go in and manually delete older ones no longer in use.
Interestingly, one way to clear the “old” unused options would be to convert a field from a drop-down to a text field and then back to a drop-down. It will result in the drop-down options only being the ones currently in the table.
I’m not sure if there is another way to automate the deletion of older drop-down items…
Dec 04, 2021 01:53 PM
There is no way to programmatically delete choices from a multi-select field.
You might want to consider using a linked record field instead.
Dec 04, 2021 02:53 PM
Good to know, thanks for your help! :thumbs_up:
Jan 13, 2022 04:00 AM
Not certain if you landed somewhere with this yet.
but here is the solution using linked fields.
Have 2 tables
Table 1
Then create a view that filters out the data based on whatever date field you chose.
(i.e. I want all selections where the record was made within 30 days.)
next
Table 2
Form will replicate the linked field that has limitation to that view
Jan 13, 2022 05:15 PM
Thanks so much for the helpful feedback @Josh_Stockbridge!
Apr 20, 2024 09:08 AM
There is another reason it's desirable to change the field type: to reset an auto numbered column.
If you create an auto numbered column, then manually reorder records and want the auto numbering to start from 1 and go to N again, the only way to do that is to temporarily change the type to integer then back to auto number.
But it looks like I can't do that in a script. 😐
I just want my records numbered from 1 to N so I know the priority order I put them in.