Category: Question and Answers
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How do I get the updated version of data from a Table Widget?

Issue

I am having trouble with my query and JS object. My query, 'write_data_3C', is supposed to write data to a Google Sheet when a button is clicked. My JS object, 'checkBox', has a function called 'options' that performs basic math on table data and returns the result. However, when I try to pass the result of 'checkBox.options' to 'write_data_3C', it writes the original data instead of the modified result. I have tried creating a new table on the page to run 'checkBox.options' on, but I still get the same result. I'm not sure what I'm missing.

Resolution

The solution provided suggests doing all the data manipulation within the JS Object, which has a function called 'options'. The revised code should call this function directly instead of passing it as an argument to the 'write_data_3C' function. The revised code will look something like this: {{JsObject.options(Table4.tableData)}}. This approach will ensure that the data manipulation is done before writing the data to the Google Sheet. Additionally, the use of console.log() to confirm the correctness of the return data is recommended.