It's all about the answers!

Ask a question

CRRPE3022E The JavaScript expression could not be evaluated. TypeError: Cannot read property "value" from undefined (src1#19)


Anh Do (111) | asked Feb 22 '17, 4:41 a.m.

 Hi team,


Currently I am using RPE to generate report for DNG module,
I am using the below java script:

if(arrayObject == '')
{
arrayObject = [];
}
var i = 0;
for( i = 0; i1 < arrayTitle.length; i++)
{
var tempObj = { title:'', value:''};
if( arrayTitle[i1] != prevTitle)
{
tempObj["title"] = arrayTitle[i1];
tempObj["value"] = arrayValue[i1];
arrayObject.push(tempObj);
}
else
{
arrayObject[i1-1].value = arrayObject[i1-1].value +', '+ arrayValue[i1];
}
prevTitle = arrayTitle[i1];
}

when I run the report template, it show error as below:
CRRPE3022E The JavaScript expression could not be evaluated.
TypeError: Cannot read property "value" from undefined (src1#19)
[Error context] Template is D:\Anh_Do\ALM\RPE\RPE_Module_detail_report_1.dta
[Error context] Template element is 90
[Error context] Expression is used for CODEBLOCK

I think I have declared array with every item is with type: var tempObj = { title:'', value:''}; so the property "value" for every item in array should be accessible. But the RPE tool keep give error like that.

Please help me on this,
Thank you,
Best regards,
Anh Do

One answer



permanent link
Donald Nong (14.3k213) | answered Mar 10 '17, 12:21 a.m.

I believe it complains about this line.

arrayObject[i1-1].value = arrayObject[i1-1].value +', '+ arrayValue[i1];
Basically your code references an undefined arrayObject[i1-1].

Not sure whether the forum messed up your code - I cannot see where you set the value for i1 and when to change it. The code makes no sense to me.

Your answer


Register or to post your answer.