Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Updating number field with user input [solved]

Topic Labels: Scripting extentions
Solved
Jump to Solution
1321 2
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi all! I’m still pretty new to scripting, but came across a problem that feels like it should have an obvious answer.

I would like a user to be able to update a number field in my base via some inputs in the script, however the input.textAsync function throws an error because the string can’t be assigned to that field type.

Aside from changing my field to a string, is there away to change the input type to a number in the scripting block?

image

Thanks!

1 Solution

Accepted Solutions

Wrap Number() around your string variable to convert it to a number:

...
table.updateRecordAsync(record, {
    'Respeaking Score': Number(score),
...

More info about JavaScript type conversion can be found here:

https://www.w3schools.com/js/js_type_conversion.asp

See Solution in Thread

2 Replies 2

Wrap Number() around your string variable to convert it to a number:

...
table.updateRecordAsync(record, {
    'Respeaking Score': Number(score),
...

More info about JavaScript type conversion can be found here:

https://www.w3schools.com/js/js_type_conversion.asp

Amazing, thank you!

I was hoping there would be an easy fix! So much to learn.