Main Content

activate

Apply view settings

    Description

    example

    activate(view) applies the view settings specified by view to the Requirements Editor and Requirements Perspective.

    Examples

    collapse all

    This example shows how to create a view and apply it to the Requirements Editor and Requirements Perspective.

    Open the myAddRequirements requirement set, which contains requirements with Type set to Functional.

    rs = slreq.open("myAddRequirements");

    Create a view with the name NewView.

    myView = slreq.View.create("NewView")
    myView = 
      View with properties:
    
              Name: 'NewView'
         ReqFilter: ''
        LinkFilter: ''
              Host: ''
    
    

    Set the requirement filter to only display requirements that have Type set to Container.

    myView.ReqFilter = "{'ReqType','Container'};"
    myView = 
      View with properties:
    
              Name: 'NewView'
         ReqFilter: "{'ReqType','Container'};"
        LinkFilter: ''
              Host: ''
    
    

    Check if the view is valid.

    tf = isValid(myView)
    tf = logical
       1
    
    

    Apply the view to the Requirements Editor and Requirements Perspective.

    activate(myView)

    Confirm that the active view is NewView.

    appliedView = slreq.View.getActiveView
    appliedView = 
      View with properties:
    
              Name: 'NewView'
         ReqFilter: "{'ReqType','Container'};"
        LinkFilter: ''
              Host: ''
    
    

    The myAddRequirements requirement set does not contain any requirements with Type set to Container, so all of the requirements are filtered out.

    filtered-requirements-editor.png

    Clear the loaded requirement sets and link sets and close the Requirements Editor.

    slreq.clear;

    Input Arguments

    collapse all

    View settings, specified as an slreq.View object.

    Version History

    Introduced in R2022b