Help

Creating a table by importing excel with single select options

Topic Labels: Importing-Exporting
950 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Erin_Alter
6 - Interface Innovator
6 - Interface Innovator

I'd like to create a new table by importing from an excel worksheet. There will be 30+ fields and i want the single select options to be True and False.

When i've tried to add the single select options manually as answers and then convert the field to be single select, it reverses the order. on my survey, i do not want the answers to be False and True, but True and False. 

Is there a way to do this without going through and manually changing every single field to single select and re-ordering the options for each one? 

thanks!

1 Reply 1
Alexey_Gusev
12 - Earth
12 - Earth

Hi,

Set table in line 1 and if you need any singleSelect field to skip, put it's name in line 2

I suppose there are 2 options only, without 'empty option', otherwise it will fail to change field options

const selects=base.getTable('Table1').fields.filter(x=>x.type==='singleSelect')
const toChange=selects.filter(x=>!['Exclude example','place fieldnames','to skip'].includes(x.name))
const swap=arr=>({choices:[arr[1],arr[0]]})
const setTF=async f=>await f.updateOptionsAsync(swap(f.options.choices))
let ask=await input.buttonsAsync('To Change: '+toChange.map(x=>x.name).join(),['Yes','No'])
if (ask=='Yes') for (let fld of toChange) await setTF(fld)