I’m a new coder, so apologies if this is an obvious thing, but I can’t seem to make it work.
I am scripting something in Google Apps Script editor as part of a larger project wherein I need to manipulate TA Forms by collecting the data, modifying it, and updating the spreadsheet. There are two versions of the form, so I decided to create a TA Form class and have a PhDForm Subclass.
ManualClean() calls getCleanedRow(). The manualClean() is the same for each subclass, but the getCleanedRow is different for each subclass.
I have the classes as follows:
class TAForms {
constructor (homeSSID, cleanedSheetSSID, templateSSID, comboFileName, outputFolderName) {
this.ssID = homeSSID;
this.cleanedSheetSSID = cleanedSheetSSID;
this.templateSSID = templateSSID;
this.comboFileName = comboFileName;
this.outputFolder = _getFolderByName(outputFolderName);
}
getCleanedRow (rawRow) {
//do stuff to clean the row
return cleanedRow;
}
manualClean() {
//takes all raw data, cleans it, and writes it to the spreadsheet.
//....
const RAWDATA = DATA.map(function (rawRow) {
let cleanedRow = this.getCleanedRow (rawRow);
return cleanedRow;
});
//....
}
class PhDTAForms extends TAForms {
constructor (homeSSID, cleanedSheetSSID, templateSSID, comboFileName, outputFolderName) {
super(homeSSID, cleanedSheetSSID, templateSSID, comboFileName, outputFolderName);
}
getCleanedRow (incomingValues) {
//clean the row following PhD Form specifics
return cleanedRow;
}
}
When I ran the code, the getCleanedRow() that is called is in the parent class, not the subclass. I was under the impression that if you declared the function in the subclass the same way as it is declared in the parent class, it would be overriden, but it does not seem to be happening here. What am I missing?