当我尝试运行我的代码时出现以下错误。
TypeError:错误#1010:术语未定义且没有属性。
private function calculateFIX001Value(custfields:Array):Number
{
var result:Number = new Number;
var valueObj:Object;
try{
var markUp:Number = 0.01;
var projectValue:String = "";
var marketCategory:String = "";
for each (var custField:Object in custfields)
{
if (custField.fieldLabel == 'Segment Category')
marketCategory = custField.selectedValue[0];
if (custField.fieldLabel == 'Project Value (R)')
projectValue = custField.selectedValue[0].toString().replace("R","");
projectValue = projectValue.replace(",","");
projectValue = projectValue.replace(",","");
projectValue = projectValue.replace(",","");
}
switch (marketCategory)
{
case "23": //5% Markup for Building
markUp = new Number(5 / 100);
break;
case "24": //11% Markup for Civils
markUp = new Number(11 / 100);
break;
case "25": //2% Markup for Scaffolding
markUp = new Number(2 / 100);
break;
default:
break;
}
if ((projectValue != "" && projectValue != '0') && marketCategory != "")
{
var revenue:Number = new Number;
//if (!_model.myProfile.switchOpportunityInMillions)
// revenue = parseFloat(projectValue) * 1000000 * markUp;
//else
revenue = parseFloat(projectValue) * markUp;
valueObj = new Object;
valueObj.label = "Expected Revenue";
valueObj.value = revenue;
//result.push(valueObj);
result = revenue;
//rm.saveOpportunityValue(_currentOpportunity.id, revenue);
}
else
{
var errorObj:Object = new Object;
var errMsg:String = "";
if (projectValue == '' || projectValue == '0')
errMsg = "Project value not specified";
if (marketCategory == "")
{
if (errMsg != "")
errMsg += " or no Segment Category has been selected";
else
errMsg = "No Segment Category has been selected";
}
errorObj.label = 'Cannot calculate value.';
errorObj.value = errMsg + '.';
//result.push(errorObj);
result = 0;
}
} catch(e:Error) {
Alert.show(e.toString());
}
return result;
}