I know it’s more JS help then CORVID, but maybe you’ll find the problem at a glance. I’m trying to write an elegant code for checking test results. I have in one table in the database all the different results, and in another table the limits values for every parameter according to the user. Now, I’m trying to pass on the different parameters in a loop and compare. But when I try to get the CurrentItem.{parameter name from an array} - I get an error.
Here is the code:
let CurrSamplingVal;
let CurrSampling;
let LimitVal;
let ParametersArray = [ “Speed” , ‘High’ , ‘Volume’ , ‘Density’ , ‘Weight’ ]; // I have a limitation that I need to check when I get a result.
// The results are in the database, and when the user click on result ID
// I need to check every parameter that it’s not exceeding the limit
for ( var i = 0 ; i < ParametersArray.length; i++) {
CurrSampling = $w( ‘#dsWastewater’ ).getCurrentItem();
console.log(ParametersArray[i]); // console: “Speed”
console.log(CurrSampling.Speed); // console: “150”
CurrSamplingVal = CurrSampling. ParametersArray [i]; //console: “TypeError: Cannot read property ‘0’ of undefined”
// To Do: Compare to the CurrentUser.Limits{parameter name from array}
}