Main Content

本页采用了机器翻译。点击此处可查看英文原文。

add

类: slreq.ReqSet
命名空间: slreq

将需求添加到需求集

语法

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

说明

req = add(rs) 将需求添加到需求集rs 并返回该需求的句柄。

req = add(rs,"Artifact",artifactName) 添加与外部需求文档artifactName 相关的引用需求。

req = add(___,reqProperty,value,...,refPropertyN,valueN) 将需求或引用的需求添加到需求集,其属性和属性值分别由 reqPropertyvalue 指定。

输入参数

全部展开

需求集,指定为 slreq.ReqSet 对象。

需求或引用的需求属性名称,指定为字符串标量或字符向量。

您只能输入 slreq.Requirement 属性slreq.Reference 属性,其中 SetAccess 属性为 public

示例: "Summary"

需求或引用的需求属性值,指定为字符串标量或字符向量。

外部需求文档名称,指定为字符串标量或字符向量。

输出参量

全部展开

需求或引用的需求,以 slreq.Requirementslreq.Reference 对象形式返回。

示例

全部展开

此示例显示如何将需求添加到需求集。

加载需求集myReqSet,它不包含任何需求。

rs = slreq.load("myReqSet");

使用 add 方法将需求添加到需求集。

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

            Type: 'Functional'
              Id: '#2'
         Summary: ''
     Description: ''
        Keywords: {}
       Rationale: ''
       CreatedOn: 20-Apr-2024 08:24:13
       CreatedBy: 'batserve'
      ModifiedBy: 'batserve'
    IndexEnabled: 1
     IndexNumber: []
             SID: 2
    FileRevision: 1
      ModifiedOn: 20-Apr-2024 08:24:13
           Dirty: 1
        Comments: [0x0 struct]
           Index: '1'

清理

丢弃需求集而不保存。

discard(rs);

此示例显示如何将引用需求添加到需求集。

加载crs_req需求集。

rs = slreq.load("crs_req");

使用 add 方法将引用的需求作为导入节点添加到需求集。将导入节点与 crs_req.docx 文件关联作为外部需求工件。

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

              Id: ''
        CustomId: ''
        Artifact: 'crs_req.docx'
      ArtifactId: ''
          Domain: 'linktype_rmi_word'
       UpdatedOn: 19-Apr-2023 15:57:41
       CreatedOn: 19-Apr-2023 15:57:41
       CreatedBy: ''
      ModifiedBy: ''
        IsLocked: 1
         Summary: ''
     Description: ''
       Rationale: ''
        Keywords: {}
            Type: 'Functional'
    IndexEnabled: 1
     IndexNumber: []
             SID: 32
    FileRevision: 1
      ModifiedOn: 19-Apr-2023 15:57:41
           Dirty: 0
        Comments: [0×0 struct]
           Index: 'Import2'

此示例显示如何在将需求添加到需求集时指定属性。

加载需求集myReqSet,它不包含任何需求。

rs = slreq.load("myReqSet");

使用 add 方法将需求添加到需求集。将需求摘要设置为 New Req,将需求描述设置为 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: 20-Apr-2024 08:24:14
       CreatedBy: 'batserve'
      ModifiedBy: 'batserve'
    IndexEnabled: 1
     IndexNumber: []
             SID: 2
    FileRevision: 1
      ModifiedOn: 20-Apr-2024 08:24:14
           Dirty: 1
        Comments: [0x0 struct]
           Index: '1'

清理

丢弃需求集而不保存。

discard(rs);

此示例显示如何在将引用的需求添加到需求集时指定属性。

加载crs_req需求集。

rs = slreq.load("crs_req");

使用 add 方法将引用的需求作为导入节点添加到需求集。将导入节点与 crs_req.docx 文件关联作为外部需求工件。将需求摘要设置为 New Import Node,将需求描述设置为 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: 17-Apr-2023 16:18:32
       CreatedOn: 17-Apr-2023 16:18:32
       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: 17-Apr-2023 16:18:32
           Dirty: 0
        Comments: [0×0 struct]
           Index: 'Import2'

提示

  • 要将一个需求添加为另一个需求的子项,请使用 slreq.Requirementadd 方法。要将引用需求添加为另一个引用需求的子项,请使用 slreq.Referenceadd 方法。要将一个申述添加为另一个申述的子项,请使用 slreq.Justificationadd 方法。

版本历史记录

在 R2017b 中推出