So, I have been working on a Sheet Worker to convert fields to new fields to consolidate the Savage Worlds Tabbed sheet. I have all the static fields working and am now working on the repeating sections. Because I have multiple repeating sections, I wanted to create a function so I only have to do the code once. Here's what I came up with: function convertRS (mookSection, wcSection, fieldArray) {
console.log("mookSection: " + mookSection);
console.log("wcSection: " + wcSection);
console.log("fieldArray: " + fieldArray);
console.log("Number of Entries in fieldArray: " + fieldArray.length);
var mookRS = "repeating_"+mookSection;
getSectionIDs(mookRS, function(idArray) {
if (idArray.length > 0) {
console.log("mookSection IDs: " + idArray);
//Create a new row in the wcSection for every row in the mookSection
for(var i=0; i < idArray.length; i++) {
var newrowid = generateRowID();
console.log("***** New Row ID: "+newrowid+" *****");
var mookRF = "repeating_" + mookSection + "_" + idArray[i] + "_m";
var wcRF = "repeating_" + wcSection + "_" + newrowid + "_";
//For this idArray SectionID value need to get the ATTRS for the entire row and create them
for(var r=0; r < fieldArray.length; r++) {
console.log("********************");
console.log("** mookRF: "+mookRF+fieldArray[r]);
console.log("** wcRF: "+wcRF+fieldArray[r]);
console.log("********************");
var getMRF = mookRF+fieldArray[r];
var putWCRF = wcRF+fieldArray[r];
getAttrs([getMRF], function(attr) {
console.log("### value to be set ("+getMRF+": " + attr.getMRF);
/*setAttrs({
[putWCRF] = attr.[getMRF]
});*/
});
}
}
}
else {
console.log("<===== "+mookSection+" had no rows =====>")
}
});
}
Everything works fine, except the getAttrs section... The console log reports attr.getMRF as Undefined, but when I use the value of getMRF in the game, it returns the appropriate value. So, what am I doing wrong with my getAttrs call? Any help is greatly appreciated.