3

I have a list of strings that I want to iterate over in dxl. They represent module ID's like so:

string limitModules[5] = ['1', '2', '3', '4', '5']

Obviously each of the module ID's are more complicated. I've constructed a for loop using the syntax of for type1 v1 in type2 v2 do. However when I run the script I get the following error:

incorrect arguments for (do)

Here's my loop exactly:

string mod_name = ""
for mod_name in limitModules do {
    // test to see if module is found
}

What am I missing?

James Mertz
  • 8,459
  • 11
  • 60
  • 87
  • To be precise limitModules is array not list. In DXL, as @Steve said there are Skip List, something like Java's Map or so called Dictionaries. – Xelian Dec 28 '15 at 18:58

2 Answers2

4

You can create a Skip List to put them in and iterate over it that way (see skip lists in the DOORS DXL Help).

Or if you need to use the String array that way you can use the following:

for(i = 0; i < 5; i++)
{
  mod_name = limitModules[i]
  // other code here
}

This method is fine if you know the size of the array. However skip lists are more efficient for this sort of thing.

Steve Valliere
  • 1,882
  • 12
  • 31
1

You can do that. A Skip List is not necessary. I am also using the approach for limiting modules before traversing the links. But you have to change the declaration:

string limitModulesLevel1[] = {"Some Name", "Even some other"}


for(i=0; i<sizeof(limitModulesLevel1); i++)
{
        ...
}
CHinrichs
  • 11
  • 3