31
Automation Interface, Add-Ins and Tools / Undefined variable in javascript script
« on: January 18, 2023, 10:15:28 pm »
Hi all,
When I'm debugging a javascript script containing the following fragment the variable 'traceElement' is reported as 'undefined' at the first line containing 'traceElement.'. Any suggestions?
..
if (currentRequirement.Type == "Requirement"){
Session.Output( "Found link between " + currentUseCase.Alias + " to " + currentRequirement.Alias );
var traceElement as EA.Element;
traceElement = tracePackage.Elements.AddNew( currentUseCase.Alias + " to " + currentRequirement.Alias, "");
traceElement.TaggedValues.AddNew("from", currentUseCase.Alias);
traceElement.TaggedValues.AddNew("to", currentRequirement.Alias);
traceElement.Update();
tracePackage.Elements.Refresh();
}
..
When I'm debugging a javascript script containing the following fragment the variable 'traceElement' is reported as 'undefined' at the first line containing 'traceElement.'. Any suggestions?
..
if (currentRequirement.Type == "Requirement"){
Session.Output( "Found link between " + currentUseCase.Alias + " to " + currentRequirement.Alias );
var traceElement as EA.Element;
traceElement = tracePackage.Elements.AddNew( currentUseCase.Alias + " to " + currentRequirement.Alias, "");
traceElement.TaggedValues.AddNew("from", currentUseCase.Alias);
traceElement.TaggedValues.AddNew("to", currentRequirement.Alias);
traceElement.Update();
tracePackage.Elements.Refresh();
}
..