Main Content

add

Class: slreq.ReqSet
Package: slreq

Add requirements to requirement set

Syntax

req = add(rs)
req = add(rs,"Artifact",artifactName)
req = add(___,reqProperty,value,...,refPropertyN,valueN)

Description

req = add(rs) adds a requirement to the requirement set rs and returns a handle to the requirement.

req = add(rs,"Artifact",artifactName) adds a referenced requirement associated with the external requirements document, artifactName.

req = add(___,reqProperty,value,...,refPropertyN,valueN) adds a requirement or a referenced requirement to the requirement set with properties and property values specified by reqProperty and value, respectively.

Input Arguments

expand all

Requirement set, specified as an slreq.ReqSet object.

Requirement or referenced requirement property name, specified as a string scalar or a character vector.

You can only enter an slreq.Requirement property or slreq.Reference property where the SetAccess attribute is public.

Example: "Summary"

Requirement or referenced requirement property value, specified as an string scalar or a character vector.

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

Output Arguments

expand all

Requirement or referenced requirement, returned as an slreq.Requirement or an slreq.Reference object.

Examples

expand all

This example shows how to add a requirement to a requirement set.

Load the requirement set myReqSet, which does not contain any requirements.

rs = slreq.load("myReqSet");

Use the add method to add a requirement to the requirement set.

req = add(rs)
req = 
  Requirement with properties:

            Type: 'Functional'
              Id: '#2'
         Summary: ''
     Description: ''
        Keywords: {}
       Rationale: ''
       CreatedOn: 31-Aug-2022 05:12:30
       CreatedBy: 'batserve'
      ModifiedBy: 'batserve'
    IndexEnabled: 1
     IndexNumber: []
             SID: 2
    FileRevision: 1
      ModifiedOn: 31-Aug-2022 05:12:30
           Dirty: 1
        Comments: [0x0 struct]
           Index: '1'

Cleanup

Discard the requirement set without saving.

discard(rs);

This example shows how to add a referenced requirement to a requirement set.

Open the CruiseRequirementsExample project and load the crs_req requirement set.

slreqCCProjectStart;
rs = slreq.load("crs_req");

Use the add method to add a referenced requirement to the requirement set as an Import node. Associate the Import node with the crs_req.docx file as the external requirements artifact.

ref = add(rs,"Artifact","crs_req.docx")
ref = 
  Reference with properties:

              Id: ''
        CustomId: ''
        Artifact: 'crs_req.docx'
      ArtifactId: ''
          Domain: 'linktype_rmi_word'
       UpdatedOn: 22-Feb-2022 16:16:54
       CreatedOn: 22-Feb-2022 16:16:54
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: ''
     Description: ''
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 32
    FileRevision: 1
      ModifiedOn: 22-Feb-2022 16:16:54
           Dirty: 0
        Comments: [0×0 struct]
           Index: 'Import2'

This example shows how to specify properties when adding a requirement to a requirement set.

Load the requirement set myReqSet, which does not contain any requirements.

rs = slreq.load("myReqSet");

Use the add method to add a requirement to the requirement set. Set the requirement summary to New Req and set the requirement description to My new requirement.

req = add(rs,"Summary","New Req","Description","My new requirement")
req = 
  Requirement with properties:

            Type: 'Functional'
              Id: '#2'
         Summary: 'New Req'
     Description: 'My new requirement'
        Keywords: {}
       Rationale: ''
       CreatedOn: 31-Aug-2022 05:12:31
       CreatedBy: 'batserve'
      ModifiedBy: 'batserve'
    IndexEnabled: 1
     IndexNumber: []
             SID: 2
    FileRevision: 1
      ModifiedOn: 31-Aug-2022 05:12:31
           Dirty: 1
        Comments: [0x0 struct]
           Index: '1'

Cleanup

Discard the requirement set without saving.

discard(rs);

This example shows how to specify properties when adding a referenced requirement to a requirement set.

Open the CruiseRequirementsExample project and load the crs_req requirement set.

slreqCCProjectStart;
rs = slreq.load("crs_req");

Use the add method to add a referenced requirement to the requirement set as an Import node. Associate the Import node with the crs_req.docx file as the external requirements artifact. Set the requirement summary to New Import Node and set the requirement description to My new Import node.

ref = add(rs,"Artifact","crs_req.docx","Summary","New Import Node","Description","My new Import node")
ref = 
  Reference with properties:

              Id: ''
        CustomId: ''
        Artifact: 'crs_req.docx'
      ArtifactId: ''
          Domain: 'linktype_rmi_word'
       UpdatedOn: 22-Feb-2022 16:19:26
       CreatedOn: 22-Feb-2022 16:19:26
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: 'New Import Node'
     Description: 'My new Import node'
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 32
    FileRevision: 1
      ModifiedOn: 22-Feb-2022 16:19:26
           Dirty: 0
        Comments: [0×0 struct]
           Index: 'Import2'

Tips

Version History

Introduced in R2017b