Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How do i load the current module and then iterate through objects to get its name (DOORS DXL)

Hello



i'm trying to fetch the content of all the artifacts in a module (current stream), i want to do it using the path of the module.

Im using below statements to read a module.
string modFullName = "\\Training\\myFolder\\test"
Module m = read(modFullName,true);
Module m = edit(modFullName, true);

above statement wont help me in looping through objects of m.

If i have a baseline
Baseline base = baseline(majVersion,minVersion,suff)
Module m = load(base,true)
then for loop works fine.

how do i load the current version of the module using a path?

regards
Arjuna





0 votes



2 answers

Permanent link
Hi Arjuna,

You can use the object function along with the null keyword to access the module object.
Ex:
string modFullName = "\\Training\\myFolder\\test"
Object modObj = null

// Find the module object using its full name
if (null(object(modFullName))) {
    print "Failed to find the module: " modFullName
} else {
    modObj = object(modFullName)
    Module m = module(modObj)

    Object obj
    for obj in entire m do {
        // Access the name of each object
        string objName = obj."Object Text"
        print "Object Name: " objName
    }
}

To explain:
 object(modFullName) is used to find the module object with the given full name. 
If the module object is found, you can create a Module instance using module(modObj)
Then, you can iterate through the objects in the module using a for loop and access the name of each object using obj.Object Text.

I hope it helps you

0 votes

Comments
I'm getting below error
-E- DXL: <Line:2> incorrect arguments for function (object)
-E- DXL: <Line:2> incorrectly concatenated tokens
-I- DXL: All done. Errors reported: 2. Warnings reported: 0.

I'm trying for the module which is present in the below location.
string modFullName = "\\Training\\test\\template"
Object modObj = object(modFullName)


Permanent link
try this
string modFullName = "\\Training\\test\\template"
Module m = read(modFullName, true)

if (null m) {
    print "Failed to read the module: " modFullName
} else {
    Object obj
    for obj in entire m do {
        // Access the name of each object
        string objName = obj."Object Text"
        print "Object Name: " objName
    }
}

0 votes

Your answer

Register or log in to post your answer.

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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 29

Question asked: Jul 17 '23, 9:55 a.m.

Question was seen: 1,852 times

Last updated: Jul 20 '23, 10:00 a.m.

Confirmation Cancel Confirm