Main Content

run

Return artifacts from query

    Description

    artifacts = run(queryObj) returns the artifacts in the project folder that match the criteria specified by the query queryObj. For more information, see Find Artifacts with Queries.

    This function requires CI/CD Automation for Simulink Check.

    Typically, you use queries inside your process model and the build system automatically runs the queries to find artifacts, but you can manually call the run function to run a query outside of your process model to confirm which artifacts the query returns.

    artifacts = run(queryObj,inputArtifact) returns the artifacts in the project folder that match the criteria specified by the query queryObj and are associated with the artifact inputArtifact. If you use the query as an iteration query or dependency query, the build system can use inputArtifact to determine the scope of the artifacts that the query returns, which can be helpful for queries that need an input artifact from a parent query.

    Examples

    collapse all

    Although you typically use queries inside your process model, you can run queries outside of your process model to confirm which artifacts the query returns.

    1. Open a project. For this example, you can open the Process Advisor example project.

      processAdvisorExampleStart

    2. Create an instance of a query. For this example, you can create an instance of the built-in query padv.builtin.query.FindArtifacts. You can use the arguments of the query to filter the query results. For example, you can use the IncludeLabel argument to have the query only return artifacts that use the Design project label from the Classification project label category.

      q = padv.builtin.query.FindArtifacts(...
      IncludeLabel = {'Classification','Design'});

      For information on built-in queries and custom queries, see Customize Your Process Model.

    3. Run the query and inspect the array of artifacts that the query returns.

      artifacts = run(q)
      artifacts = 
      
        1×24 Artifact array with properties:
      
          Type
          Parent
          ArtifactAddress
          Alias

    Input Arguments

    collapse all

    Query object, specified as a padv.Query object, built-in query object, or an object whose class inherits from either the padv.Query class or a built-in query class.

    For information on built-in queries and custom queries, see Customize Your Process Model.

    Example: q = padv.Query("myQueryName")

    Example: q = padv.builtin.query.FindArtifacts

    Input artifact that the query needs, specified as a padv.Artifact object.

    Output Arguments

    collapse all

    Artifacts that query returns, returned as an array of padv.Artifact objects.