Dec 23, 2020 05:20 AM
Hi
I wanna script a (+1) button, somehow (like) button… to increase (or decrease) number in a filed
For example, When I click this button, the filed X become (10) instead of (9)
Thanks
Solved! Go to Solution.
Dec 24, 2020 12:25 PM
Happy Holidays
const config = input.config({
title: 'Add 1 to a number field',
description: 'A script that lets you increment a number',
items: [
input.config.table('table', {
label: 'Table',
}),
input.config.field('numberField', {
label: 'Number field',
parentTable: 'table',
}),
]
});
const record = await input.recordAsync("Pick a record", config.table)
const currentNumber = record.getCellValue(config.numberField)
const newNumber = currentNumber ? currentNumber + 1 : 1
await config.table.updateRecordAsync(record, {
[config.numberField.name]: newNumber
})
output.markdown(`Updated ${config.numberField.name} for ${record.name} to ${newNumber}`)
Dec 25, 2020 01:53 PM
Dec 24, 2020 09:56 AM
Welcome to the Airtable community!
Do you want to hire someone to write this script for you?
Are you hoping that someone will write this script for you for free?
Are you trying to write a script and need help debugging it?
Dec 24, 2020 10:13 AM
Yes I can hire someone, I just not sure if that possible.
I know little about coding
Dec 24, 2020 11:39 AM
Yes, this is quite possible with a script. Several people in this community (myself included) write scripts for hire.
Dec 24, 2020 12:25 PM
Happy Holidays
const config = input.config({
title: 'Add 1 to a number field',
description: 'A script that lets you increment a number',
items: [
input.config.table('table', {
label: 'Table',
}),
input.config.field('numberField', {
label: 'Number field',
parentTable: 'table',
}),
]
});
const record = await input.recordAsync("Pick a record", config.table)
const currentNumber = record.getCellValue(config.numberField)
const newNumber = currentNumber ? currentNumber + 1 : 1
await config.table.updateRecordAsync(record, {
[config.numberField.name]: newNumber
})
output.markdown(`Updated ${config.numberField.name} for ${record.name} to ${newNumber}`)
Dec 25, 2020 01:53 PM
Happy Holidays!
This Worked great…
Thank you!