I can read the json from calcList1 in the if statement, and thought I could just push them into the l=[] stack. I am not sure what I am missing here, Because I am getting an error.
error:
"name": "TypeError",
"message": "'undefined' is not an object (evaluating 'l[0].z_param_name')",
loop:
var calcList1 = require('ui/common/convertd/calcs_db/calcs_models/outSort2').calcs_list;
var l = [];
var x = 0;
for (var i = 0; i < calcList1.length; i++) {
if (calcList1[i].z_clac_id == _args.z_dex) {
//>>>>this works>>>>>> Ti.API.info('>>', calcList1[i].z_param_name)
l.push = ( {
z_clac_id : calcList1[i].z_clac_id,
z_find : calcList1[i].z_find,
z_param_id : calcList1[i].z_param_id,
z_param_name : calcList1[i].z_param_name,
z_param_unit : calcList1[i].z_param_unit
});
}
};
Ti.API.info('>>>>>>>>>>>>>>>>>>>>>>>>>>', l[0].z_param_name);
I think you don't need equal sign '=' in here but I'm not sure if this is the main issue in here:
l.push( {
z_clac_id : calcList1[i].z_clac_id,
z_find : calcList1[i].z_find,
z_param_id : calcList1[i].z_param_id,
z_param_name : calcList1[i].z_param_name,
z_param_unit : calcList1[i].z_param_unit
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.