Jun 07, 2022 08:14 AM
Notice: I am on a free plan and do not have access to any paid tools by Airtable or another company.
I am trying to export airtable data in a csv. The place I am importing to cannot recognize “drop down” menu options.
I need to extract about 100 dropdown menu options* and format them thusly in a “text” field
["value1", "value2"]
*When I mention options I am talking about all the options in the dropdown menu, not just the ones selected and displayed.
I don’t know if this is possible, but if anyone knows a workaround that would be awesome. It would save me the hassle of having to type them all out with that formatting. :dizzy_face:
Solved! Go to Solution.
Jun 07, 2022 09:46 AM
Hi @Anxious
If you add the scripting app (this is available in the free plan) to the right side panel. Open it up from scratch and remove all of the default scripts. then add this script
let table = base.getTable("Table")
let multipleSelectField = table.getField('Dropdown');
for (let choice of multipleSelectField.options.choices){
output.markdown(`
${choice.name}
`)
}
Change the Table and Dropdown parts in my script to match the names of your table and dropdown. Then run it. It will output all the options in text.
Jun 07, 2022 09:46 AM
Hi @Anxious
If you add the scripting app (this is available in the free plan) to the right side panel. Open it up from scratch and remove all of the default scripts. then add this script
let table = base.getTable("Table")
let multipleSelectField = table.getField('Dropdown');
for (let choice of multipleSelectField.options.choices){
output.markdown(`
${choice.name}
`)
}
Change the Table and Dropdown parts in my script to match the names of your table and dropdown. Then run it. It will output all the options in text.
Jun 08, 2022 03:50 PM
That code was fantastic, thank you! I was able to grab all available choices and format them.
On another note, how do you get the choices that are currently in the fields to be formatted like this: “Choice”, “Choice2”.
I duplicated the multichoice field and converted it to text.
Result:
Choice1, Choice2, Choice3
Now I am looking for a formula field to format the output text.
“Choice1”, “Choice2”, “Choice3”
I have hundreds and hundreds of rows, so doing this by hand is not an option. :dizzy_face:
Importing and exporting between platforms is a NIGHTMARE. XD
Jun 09, 2022 09:31 AM
Hi @Anxious
You should be able to take that into a text editing program to format it the way you want.
or you can try something like this
let table = base.getTable("Episodes")
let multipleSelectField = table.getField('Status');
let array = []
for (let choice of multipleSelectField.options.choices){
array.push(choice.name)
}
output.markdown(`${array}`)