Hello: I have several stand-alone (not associated to a data object) tables on a form. All have one field. I built a function that is supposed to read the value of field in the table. The function expects two parameters: table name and ID. In the function I create an array using the ca_fdGetInsertedTableRows(formId, _id) function. The problem is that when I try to use the ID string to read the value, I get an "undefined" error.
{
submitRequest: function() {
let arrTableList = ['table1','table2','table3']
let arrIDList = []
let i = 0
let strText
for (i = 0; i < 3; i++) {
switch(arrTableList[i]) {
case 'table1': strID = 'a'; break;
case 'table2': strID = 'b'; break;
case 'table13: strID = 'c'; break;
default: break;
}
strText = ca_fd.js.processTable(arrTableList[i],strID);
}
return true;
},
Process Table: function(arrTable,strID) {
let strTemp = '';
let arrTable = ca_fdGetInsertedTableRows(ca_fd.formId, arrTable);
//The below code does not work.
strTemp = arrTable[0].strID
//The below code works. I do not want to have to specify the ID, however, the place where the ID goes will not accept the parameter variable passed in from the function.
strTemp = arrTable[0].a
return true;
}
}
Can only I refer to an ID by its name or is there a way to user a variable in its place? Any advice will be greatly appreciated. Thank you. Scott.