Main Content

Customize Requirement Index Numbering

You can disable the index for an individual requirement, referenced requirement, or justification or set the index to a specified value. To customize the index numbering, use the Requirements Editor or set the object properties at the MATLAB® command line.

Disable Index Numbering

Requirement sets in Requirements Toolbox™ contain a hierarchy of requirements. Requirements Toolbox assigns each requirement an index number that identifies what level of the hierarchy the requirement is in and where it is within the level.

Index numbering for requirement 1.3 and its children is disabled.

You can disable index numbering for an individual requirement, referenced requirement, or justification in the hierarchy. Disabling numbering also disables index numbering for all descendant requirements. However, the requirements, referenced requirements, and justifications remain in the same place in the hierarchy.

To disable index numbering, in the Requirements Editor, right-click the requirement and select Disable index numbering.

Index numbering for requirement 1.3 and its children is disabled.

To re-enable index numbering, right-click the requirement and select Enable index numbering. However, index numbering for descendant requirements remains disabled. You must individually re-enable index numbering for each descendant requirement.

Tip

You can also re-enable requirement index numbering at the MATLAB command line. For more information, see Programmatically Customize Index Numbering.

Index numbering for requirement 1.3 is enabled but its children still has index numbering disabled.

Set the Index to a Specified Value

To set the index of a requirement, referenced requirement, or justification to a specified value:

  1. In the Requirements Editor, right-click the requirement and select Set index numbering.

  2. In the Index number dialog box, clear Use default auto numbering. In the Restart numbering from field, enter the desired requirement index value. You can only enter an integer value.

  3. Click OK.

Setting the requirement index to a specific value changes the index numbering for the requirements that come after the requirement and any descendant requirements.

The index for requirement 1.3 is set to 1.4. Its children are now 1.4.1 and 1.4.2. The previous requirement 1.4 is now 1.5, and so on.

To set the index number back to the default value, right-click the requirement and select Set index numbering. In the Index number dialog box, select Use default auto numbering.

Note

You cannot move a requirement to another level in the hierarchy by specifying the index value. Instead, use Promote Requirement or Demote Requirement in the Requirements Editor toolstrip. You cannot promote or demote referenced requirements.

Programmatically Customize Index Numbering

You can customize the index numbering for slreq.Requirement, slreq.Reference, and slreq.Justification objects at the MATLAB command line. To get a handle to an object, use:

  • slreq.find to search the loaded Requirements Toolbox objects

  • The find method of slreq.ReqSet to search in a requirement set

  • slreq.getCurrentObject to get a handle to the selected object in the Requirements Editor

Disable Index Numbering Programmatically

To disable index numbering programmatically, set the IndexEnabled property of the requirement object to false.

myReq = slreq.find(Type="Requirement",Summary="My Requirement 1");
myReq.IndexEnabled = false;
Disabling index numbering also disables index requirement numbering for all descendant requirements.

To re-enable index numbering programmatically, set the IndexEnable property of the requirement object to true.

myReq.IndexEnabled = true;
Index numbering for descendant requirements remains disabled. You must individually re-enable index numbering for each descendant requirement.

Specify the Index Value Programmatically

To specify the requirement index value programmatically, set the IndexNumber property of the requirement object to an integer number.

myReq = slreq.find(Type="Requirement",Summary="My Requirement 1");
myReq.IndexNumber = 101;

Note

You cannot move the requirement to another level in the hierarchy by specifying the index value. Instead, use:

  • move for slreq.Requirement objects

  • move for slreq.Justification objects

You cannot move referenced requirements.

Setting the requirement index to a specific value changes the index numbering for the requirements that come after the requirement and any descendant requirements.

To reset the requirement index to the default value, set the IndexNumber to an empty array.

myReq.IndexNumber = [];

Reset Index Numbering for Multiple Requirements Programmatically

You can re-enable index numbering and reset the requirement index to the default value for multiple requirements programmatically.

For example, this script:

  • Finds a loaded requirement set called myReqSet

  • Finds the slreq.Reference objects in the requirement set

  • Enables index numbering for all referenced requirements in the requirement set

  • Resets the index value to the default value for all referenced requirements in the requirement set

rs = slreq.find(Type="ReqSet",Name="myReqSet");
refs = find(rs,Type="Reference");
for i = 1:numel(refs)
    refs(i).IndexEnabled = true;
    refs(i).IndexNumber = [];
end
Alternatively, use this function to reset index numbering for all descendant requirements of a given requirement. The function enables index numbering and resets the index to the default numbering. It accepts slreq.Requirement, slreq.Reference, and slreq.Justification objects as inputs.
function resetDescendantIndex(ref)
    childRefs = children(ref);
    for i = 1:numel(childRefs)
        childRefs(i).IndexEnabled = true;
        childRefs(i).IndexNumber = [];
        resetDescendantIndex(childRefs(i));
    end
end

See Also

| | |

Related Topics