I have a table that's thousands of lines long, with a column called "Formula" which contains small string expressions like:
amount = salary * 0.11;
What I'm trying to do is run this string in my code, so that it updates the `amount` variable based on which line I select. However, I am running into an error when I try to run the string as code.
This is my code, which is able to compile with the correct answer in other online compilers. However, when I run this in my automation script (specifically the line where I call `func()`) I receive TypeError: func is not a function.
let code = "amount = salary * 0.11;";
// Define the function with the desired arguments
let func = new Function('salary', code);
// Call the function with the desired argument values
I understand this, and this is why I’m attempting to use a function constructor instead to accomplish the same thing. Is this explicitly forbidden, like using eval() is? I feel like it shouldn’t be
It's the same concept. Airtable doesn't like automation scripts to run code generated at run-time. If you feel that the behavior should be different, you can submit a feature request to Airtable support.