How to create a condition on a container to search for a specific value in an attribute?
![]() RPE 6.0.6.1 and DOORS Classic 9.6.11
As I am iterating through a linked module, I want to check an attribute for a specific value. The attribute has 1 to n values in a "\n" separated list. Think a Link By Attribute list of target ids.
From the Module/Object, I set a variable to capture the Absolute Number of the current object. Then, I traverse using Module/Link/Linked Object to get to the current linked object. Before I execute what is in that container, I want to check to see if the linked object's LBA_Attribute matches the variable containing the Absolute Number of the calling object.
I envision having to some some sort of java script to accomplish this check, by splitting the LBA_Attribute into an array, and then using array.indexOf to check the values. I have never really done any javascript coding, and going to the school of Google search is becoming very time consuming. So, perhaps a smart JS programmer who also understands the context of RPE could throw me a bone.
I've been messing with this snippet. The split value is currently comma, which is not the format of the LBA Attribute.
I am not sure of the correct Regexp for newline or carriage return, or whatever DOORS is using to separate the target ids. If I try to test this, I get errors, or the whole string gets printed, including the commas.
var target = LBA_FHA_HAZARDS_ID.split(',');
function contains(target, HAZ_ABS_NUM) {
for (var i = 0; i < target.length; i++) {
if (target[i] === HAZ_ABS_NUM) {
return true;
}
}
return false;
}
LBA_FHA_HAZARDS_ID is the attribute in the linked module that has target ids for Link By Attribute
HAZ_ABS_NUM is the attribute in the module/object that was populated with the Absolute Number of the current object.
|
Be the first one to answer this question!
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.