I am currently working with DOORS and require assistance in comparing attributes of objects between two modules using DXL.
The objective is to compare attributes of objects across two modules. Each object possesses a unique identifier attribute, referred to as "ID". In the first module, this attribute is named "IE ID", while in the second module, it is labeled as "Req Id". Those attributes aids in identifying corresponding objects across modules. Once matching objects are identified based on this identifier, the goal is to compare other attributes of these objects to detect any disparities.
Although I have already developed some DXL code for this purpose, I am encountering challenges in efficiently comparing attributes and detecting differences between corresponding objects.
I require assistance in refining my DXL code to accurately compare attributes of objects across modules and efficiently identify any discrepancies.
Thank you for your assistance!
I tried this code :
Module m1 = current
Module m2 = edit("/Firts project/System/Module Verification")
Object obj1
Object obj2
string ID1
string ID2
ID1 = obj1."IE ID" ""
obj2 = obj1 in m2
if (obj2 != null) {
ID2 = obj2."Req Id" ""
if (ID1 == ID2) {
for attr in obj1 do {
if (attr != "IE ID") {
string att1 = attr ""
string att2 = obj2.(attr) ""
if (att1 != att2) {
print "Différence détectée pour l'objet " obj1."Absolute Number" " :"
print " Attribut : " attr
print " Module 1 : " att1
print " Module 2 : " att2
}
}
}
}
} else {
print "Objet non trouvé dans le deuxième module pour l'objet " obj1."Absolute Number"
}
But it shows me a lot of error messages
Edit: Update in the code snippets after the discussion in the other answers
If the general loop shall be:
Then the code for step 1 is
Step 1 must be replaced if this is about DXL Layout columns or DXL Attributes. In these cases, the code for step 1 will just be
The code for step 2 will be
The code for step 3 will be (if you iterate over the attributes defined in m1)
You might have to adopt this if some AttrDefs are defined as integer or Date, but the general steps should be rather clear now.