Main Content

slreq.import

Import requirements from external documents

Description

slreq.import(docPath) imports requirements from the external document located at docPath and saves them as referenced requirements in a new requirement set with the same name as the external document. Use this function to import requirements from Microsoft® Office documents and from files in the Requirements Interchange Format.

example

[refCount, reqSetFilePath, reqSetObj] = slreq.import(docPath) imports requirements as referenced requirements from the external document and returns the number of generated reference requirements refCount, the path of the requirements set that contains the referenced requirements, reqSetFilePath, and the name of the referenced requirements object, reqSetObj.

example

slreq.import(docType) imports requirements as referenced requirements from an external document that is of the registered document type docType. The function saves the imported requirements in a new requirement set with the same name as the external document.

example

slreq.import(___,Name=Value) specifies options using one or more name-value arguments in addition to the input arguments in previous syntaxes.

example

slreq.import("clearcache") cleans up the temporary HTML files that are created when importing rich text requirements.

example

Examples

collapse all

Import referenced requirements from a Microsoft Word document.

slreq.import("Specification002.docx");

Import rows 3 to 150 of the spreadsheet MyExcelDoc.xlsx as rich text. Map the second column of the spreadsheet to the ID property of the requirements and the third column to the Description property of the requirements. Then, clean up the temporary HTML files.

slreq.import("MyExcelDoc.xlsx",rows=[3 150],...
idColumn=2,descriptionColumn=3,RichText=true);

slreq.import("clearcache");

Import referenced requirements from a Microsoft Excel® document and return the number of imported requirements, the requirement set file path, and the requirement set object.

[count,reqSetFilePath,reqSet] = slreq.import( ...
    "ExampleRequirements.xlsx");

Import referenced requirements from an IBM DOORS module. To import referenced requirements, the DOORS application must be running, you must be logged in, and the module you want to import must be open and current.

slreq.import("linktype_rmi_doors");

Input Arguments

collapse all

Path of the external requirements document or ReqIF file, specified as a string scalar or character vector.

Document type of the external requirements document, specified as a character vector. The value of docType must match the label for one of the registered document domains. You can specify either a built-in or custom-defined document domain. To see the list of registered domain labels, run this command:

rmi("linktypelist");
For example, to import requirements from the current open IBM DOORS® module, specify the docType as "linktype_rmi_doors".

Name-Value Arguments

expand all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: slreq.import(docPath,AsReference=true) imports the requirements in the document located at docPath as reference requirements.

General Options

expand all

Option to import requirements as referenced requirements, specified as a true or false.

To import the requirements as referenced requirements, set the value to true. Use this option if you want to continue to manage the requirements in a third-party tool. To import the requirements as slreq.Requirement objects set the value to false. Use this option to migrate the requirements to Requirements Toolbox™. For more information, see Select an Import Mode.

Example: AsReference=true

Attribute names for custom attribute columns, specified as a cell array of character vectors.

Note

When importing requirements from a Microsoft Excel spreadsheet, the length of this cell array must match the number of columns specified by the attributeColumn argument.

Example: attributes={'Test Status','Test Procedure'}

External requirements document identifier, specified as a string scalar or character vector.

Tip

When importing from IBM DOORS, use the DocID argument to specify the module ID.

Example: DocID="0000abcd"

Custom pre-import callback script name to use during import, specified as a string scalar or character vector.

The script that you assign to this callback executes before you import or update requirements. For more information, see Use Callbacks to Customize Requirement Import Behavior.

Example: preImportFcn="myPreImportScript"

Custom post-import callback script name to use during import, specified as a string scalar or character vector.

The script that you assign to this callback executes after you import or update requirements. For more information, see Use Callbacks to Customize Requirement Import Behavior.

Example: postImportFcn="myPostImportScript"

Name of the requirement set to import requirements into, specified as a string scalar or character vector.

If the requirement set exists, the requirements import under a new Import node. If the requirement set does not exist, Requirements Toolbox creates it.

Example: ReqSet="My_Requirements_Set"

Option to import requirements as rich text, specified as true or false. To import rich text requirements, set RichText to true.

Example: RichText=true

Options for Microsoft Excel and Microsoft Word

expand all

Option to import requirements content using user-defined bookmarks, specified as numeric or logical 1 (true) or 0 (false).

By default, Requirements Toolbox sets the value to 1 for Microsoft Word documents and 0 for Microsoft Excel spreadsheets.

Example: bookmarks=false

Regular expression pattern for ID search in Microsoft Office documents, specified as a string scalar or character vector.

Example: match="^REQ\d+"

Options for Microsoft Excel

expand all

Range of columns in the Microsoft Excel spreadsheet to map as custom attributes of the requirements in your requirement set, specified as a double array.

Example: attributeColumn=[4 6]

Range of columns to import from the Microsoft Excel spreadsheet, specified as a double array.

Example: columns=[1 6]

Column in the Microsoft Excel spreadsheet to map to the CreatedBy property of the requirements in your requirement set, specified as a double.

Example: createdByColumn=5

Column in the Microsoft Excel spreadsheet to map to the Description property of the requirements in your requirement set, specified as a double.

Example: descriptionColumn=2

Column in the Microsoft Excel spreadsheet to map to the ID property of the requirements in your requirement set, specified as a double.

Example: idColumn=1

Column in the Microsoft Excel spreadsheet to map to the Keywords property of the requirements in your requirement set, specified as a double.

Example: keywordsColumn=3

Column in the Microsoft Excel spreadsheet to map to the ModifiedBy property of the requirements in your requirement set, specified as a double.

Example: modifiedByColumn=6

Column in the Microsoft Excel spreadsheet to map to the Rationale property of the requirements in your requirement set, specified as a double.

Example: rationaleColumn=5

Range of rows to import from Microsoft Excel spreadsheet, specified as a double array.

Example: rows=[3 35]

Name of worksheet to import from Microsoft Excel workbook, specified as a string scalar character vector.

Example: sheet="Sheet1"

Column in the Microsoft Excel spreadsheet to map to the Summary property of the requirements in your requirement set, specified as a double.

Example: summaryColumn=4

Import from Microsoft Excel spreadsheets specified in the USDM (Universal Specification Describing Manner) standard format. Specify values as a character vector with the ID prefix optionally followed by a separator character.

Example: USDM="RQ -" will match entries with IDs similar to RQ01, RQ01-2, RQ01-2-1 etc.

Options for ReqIF Files

expand all

ReqIF attribute mapping, specified as a containers.Map object.

Example: attr2reqprop=attrMap

Option to import links when importing requirements from ReqIF files, specified as true or false.

Example: importLinks=true

Path of the attribute mapping file, specified as a string scalar or character vector.

Example: mappingFile="D:/reqifmapping/myMapping.xml"

Name of the profile to use when importing requirements and links from ReqIF files, specified as a string scalar or character vector.

If a profile with this name does not exist, the software creates the profile and assigns the profile to the imported requirement set and link set. If a profile with this name exists, the software assigns the profile to the imported requirement set and link set.

Example: profile="myProfile"

Name of the profile mapping XML file to use when importing requirements and links from ReqIF files, specified as a string scalar or character vector.

The profile mapping file specifies how ReqIF requirement, link types, and attributes map to Requirements Toolbox stereotypes and stereotype properties. To use this argument, you must also specify the profile to assign to the imported requirement set and link set by using the profile argument.

Tip

You can create a profile mapping file from a requirement set that has a profile mapping by using the saveProfileMapping method.

Example: profileMapping="myMapping.xml"

Import Options for DOORS and Custom Defined Document Types

expand all

Name of the attribute from the external document to map to the Keywords property for the imported requirements, specified as a string scalar or character vector.

Example: keywords="Requirement Keywords"

Name of the attribute from the external document to map to the Rationale property for the imported requirements, specified as a string scalar or character vector.

Example: rationale="Requirement Rationale"

Output Arguments

collapse all

Number of imported reference requirements, returned as a double.

Path of requirement set file that contains imported requirements, returned as a character vector.

Requirement set to which you import requirements to, returned as an slreq.ReqSet object.

Limitations

  • MATLAB® Online™ does not support importing requirements from Microsoft Word, Microsoft Excel, or IBM® DOORS documents.

Tips

Version History

Introduced in R2018a

expand all