I need to iterate through each object in the "mVerification" module, extract the value of the "(dxl) Req. Id" attribute, and then search for a corresponding object in the "mdata" module with the same value for the "Req. Id" attribute. Then, I need to check if the "Acceptance" attribute of this object in "mdata" has the value "Accepted". If it does, I want to assign the value "True" to a variable s, otherwise "False".
Module mVerification = current Module // Module "mVerification"
Module mdata = read("/Requirements/Analysis/data") // Path to the "mdata" module
Object Verif
Object oDATA
string reqID
string s = null
Object findObjectByReqID(Module mdata, string reqID) {
Object obj
for obj in mdata do {
if (obj."Req. Id" "" == reqID) {
return obj
}
}
return null
}
for Verif in mVerification do {
reqID = Verif."(dxl) Req. Id" ""
oDATA = findObjectByReqID(mdata, reqID)
if (!null oDATA && oDATA."Acceptance" "" == "Accepted") {
s = "True"
} else {
s = "False"
}
// Display the value of s for this object
}
Display s
My code doesn’t work. It keeps displaying “False” even the condition is “True”.
I would appreciate any assistance in optimizing or improving this approach. Thank you in advance for your contribution!
This is code for a DXL Layout column, right? Code for DXL Layout will be called for each object to be displayed. The object to be displayed is given to you in the variable "obj".
So, you do not need the loop
for Verif in mVerification, you just need to run the code for the current object, so the code would begin with the statementreqID = obj."(dxl) Req. Id" ""