Main Content

importFromDocument

Class: slreq.ReqSet
Namespace: slreq

Import editable requirements from external documents

Description

importFromDocument(rs,pathToFile) imports editable requirements from the external document at pathToFile to the requirement set specified by rs.

example

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

example

Input Arguments

expand all

Requirement set file, specified as a slreq.ReqSet object.

Path to the requirements document file that you want to import editable requirements from, specified as a string scalar or character vector.

Example: "C:\MATLAB\System_Requirements.docx"

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 continue to manage the requirements in a third-party tool, import the requirements as referenced requirements by setting the value to true or using the default value. To migrate the requirements to Requirements Toolbox™, import the requirements as slreq.Requirement objects by setting the value to false. 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 for import using 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 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 that you want 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 attribute mapping file, specified as a string scalar or character vector.

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

Name of 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 it and assigns it to the imported requirement set and link set. If a profile with this name exists, the software assigns it to the imported requirement set and link set.

Example: profile="myProfile"

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

The profile mapping XML file specifies how ReqIF requirement and 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 that you want 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 that you want to map to the Rationale property for the imported requirements, specified as a string scalar or character vector.

Example: rationale="Requirement Rationale"

Examples

expand all

This example shows how to create a requirement set and import requirements from a Microsoft Excel spreadsheet to the requirement set.

% Create a new requirement set and save it
rs = slreq.new("newReqSet");
save(rs);

% Import editable requirements as rich text from a Word document
importFromDocument(rs,"C:\Work\Requirements_Spec.docx");

This example shows how to create and save a requirement set. Then, the example shows how to import requirements by specifying the rows and columns to import, and the columns to map to the Summary and ID properties of the requirements.

% Create a new requirement set and save it
rs = slreq.new("newReqSet");
save(rs);

% Import editable requirements from an Excel spreadsheet
importFromDocument(rs,"C:\Work\Req_Spec.xlsx", ... 
columns=[2 6],rows=[3 32],idColumn=2, ...
summaryColumn=3);

Version History

Introduced in R2018a