Move referenced requirement up in hierarchy
tf = moveUp(ref)
tf = moveUp(
ref up one spot in the hierarchy, and returns
1 if the move executes without error. The
ref cannot be moved to a new level in the hierarchy.
You can use this method only in the
tf — Move success status
Move success status, returned as a
0 of data type
Move Referenced Requirement in
This example shows how to move an imported referenced requirement up and down in the hierarchy in the
slreq.import to import the ReqIF™ file
mySpec.reqif into Requirements Toolbox™. Name the imported requirement set
myReqSet, register the script
myPreImportScript2 as the
PreImportFcn, and register the script
movePostImport as the
PostImportFcn callback to use during import. Return a handle to the requirement set.
[~,~,rs] = slreq.import("mySpec.reqif",ReqSet="myReqSet",preImportFcn="myPreImportScript2",postImportFcn="movePostImport");
slreq.getCurrentImportOptions to get the import options, then specifies the attribute mapping file to use during import.
importOptions = slreq.getCurrentImportOptions; importOptions.MappingFile = "myMappingFile2.xml";
The mapping file
myMappingFile2.xml maps these attributes from the ReqIF file to these properties in Requirements Toolbox:
slreq.getCurrentObject to get a handle to the import node, gets the requirement set that the import node belongs to. The script then finds the referenced requirement that has
Summary set to
Requirement 3 and moves it up. It also finds the referenced requirement that has
Summary set to
Requirement 1 and moves it down.
topRef = slreq.getCurrentObject; rs = reqSet(topRef); ref1 = find(rs,Type="Reference",Summary="Requirement 3"); tf1 = moveUp(ref1); ref2 = find(rs,Type="Reference",Summary="Requirement 1"); tf2 = moveDown(ref2);
Introduced in R2022a