Hi everyone. I'm not a coder so have been relying on ChatGPT to help me with scripts. It gave me this one for a spellchecker that looks in a field for misspellings of the word "epilepsy". I have checked the name of the field and of the table are correct and filled in accordingly, but when I run the script, nothing happens. No error message, it just runs and the console remains empty. Any ideas what's going on? Here is my script:
// Define the table and field you want to check
var tableName = "YourTableName"; // Replace with your actual table name
var fieldName = "YourFieldName"; // Replace with your actual field name
// List of common misspellings
var misspellings = ["epilepsey", "epilipsy", "epilepcy", "epilepsy",
"eppilepsy", "epillepsy", "epilepsy", "epliepsy",
"epilespy", "epilepsie"];
// Function to search for misspellings
async function findMisspellings() {
var table = base.getTable(tableName);
var query = await table.selectRecordsAsync();
var foundMisspelling = false;
console.log(`Checking records in ${tableName} for misspellings in ${fieldName}...`);
query.records.forEach(record => {
var text = record.getCellValueAsString(fieldName);
if (text) {
misspellings.forEach(misspell => {
if (text.toLowerCase().includes(misspell)) {
console.log(`Misspelling found in record ${record.id}: ${misspell}`);
foundMisspelling = true;
}
});
}
});
if (!foundMisspelling) {