Hello,
I’m using pory.io and I tried to implament a “like” system in my table - a button with script that when pressed it increments "“likes” col in the row it has been pressed.
But when using the button in pory.io it sends me to the table and opens the row details.
The code:
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: 'Idea Table',
}),
input.config.field('numberField', {
label: 'Likes',
parentTable: 'table',
}),
]
});
const record = await input.recordAsync("Pick a record", config.table)
const currentNumber = record.getCellValue('Likes');
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}`)