Main Content

padv.builtin.query.GetIterationArtifact Class

Namespace: padv.builtin.query
Superclasses: padv.Query

Query for getting current task iteration artifact

Description

This class requires CI/CD Automation for Simulink Check.

The padv.builtin.query.GetIterationArtifact class provides a query that can return the current task iteration artifact.

You can use this query in your process model to find artifacts for your task to use as inputs. For example, if a task iterates over the models in the project, you can use the GetIterationArtifact query as an input query for the task to use the models in the project as inputs to the task.

The padv.builtin.query.GetIterationArtifact class is a handle class.

Creation

Description

query = padv.builtin.query.GetIterationArtifact() creates a query for getting the current task iteration artifact.

example

Properties

expand all

Query title, specified as a string or a character vector.

Example: "Get artifact that task is iterating over"

Data Types: char | string

Initial query that runs before iteration query, specified as either a padv.Query object or the Name of a padv.Query object. When you specify an iteration query for a task, the parent query is the initial query that the build system runs before running the specified iteration query.

For information on how to improve Process Advisor load times by sharing query instances across your process model, see Best Practices for Process Model Authoring.

Example: sharedQuery

Example: "FindMyInitialArtifacts"

Unique identifier for query, specified as a string.

Example: "FindCurrentIterationArtifact"

Data Types: string

Show file extensions in the Alias property of returned artifacts, specified as a numeric or logical 1 (true) or 0 (false). The Alias property controls the display name for the artifact in the Tasks column in Process Advisor.

By default, queries strip file extensions from the Alias property of each task iteration artifact. To show file extensions for all artifacts in the Tasks column, select the project setting Show file extensions. To keep file extensions in the results for a specific query, specify the query property ShowFileExtension as true.

Example: true

Data Types: logical

Setting for automatically sorting artifacts by address, specified as a numeric or logical 1 (true) or 0 (false). When a query returns artifacts, the artifacts should be in a consistent order. By default, the build system sorts artifacts by the artifact address.

Alternatively, you can sort artifacts in a different order by overriding the internal sortArtifacts method in a subclass that defines a custom sort behavior. For an example, see Sort Artifacts in Specific Order.

The build system automatically calls the sortArtifacts method when using the process model. The sortArtifacts method expects two input arguments: a padv.Query object and a list of padv.Artifact objects returned by the run method. The sortArtifacts method should return a list of sorted padv.Artifact objects.

Example: SortArtifacts = false

Data Types: logical

Handle to the function that a function-based query runs, specified as a function_handle.

If you define your query functionality inside a function and you or the build system call run on the query, the query runs the function specified by the function_handle.

The built-in queries are defined inside classes and do not use the FunctionHandle.

Example: FunctionHandle = @FunctionForQuery

Data Types: function_handle

Methods

expand all

Examples

collapse all

Suppose that you have a task that iterates over each model in the project. Although the task iterates over those models, the task does not use those models as inputs unless you specify the input query for the task. To use the models as inputs to the task, you can specify GetIterationArtifact as an input query for the task.

The built-in tasks typically use GetIterationArtifact as an input query. For example, the built-in task GenerateSimulinkWebView uses the GetIterationArtifact query as an input query to use the models that the task iterates over as inputs to the task.

In Process Advisor, the Tasks column shows the artifacts that the task iterates over. When you point to task results in the I/O column, you can see the task inputs and input dependencies.

Diagram showing IterationQuery connected to task iterations, InputQueries connected to the task inputs, and InputDependencyQuery connected to the dependencies

Suppose that you define a custom task, MyCustomTask, inside a class file. You define when the task runs and the task inputs by setting the task properties:

  • IterationQuery — Determines how often the task runs by finding the artifacts that the task iterates over. For example, the task can find and iterate over the models in the project.

  • InputQueries — Finds inputs for the task. For example, the task can find the current task iteration artifact, such as a model, and use that artifact as a task input.

Inside the class definition file, you can specify:

classdef MyCustomTask < padv.Task
    methods
        function obj = MyCustomTask(options)
            arguments
                options.Name = "MyCustomTask";
                options.IterationQuery = "padv.builtin.query.FindModels";
                options.InputQueries = "padv.builtin.query.GetIterationArtifact";
            end
            
            obj@padv.Task(options.Name,...
                IterationQuery=options.IterationQuery,...
                InputQueries=options.InputQueries);
        end
        function taskResult = run(obj,input)
            taskResult = padv.TaskResult;
            taskResult.Status = padv.TaskStatus.Pass;
        end
    end
end
When you specify InputQueries as padv.builtin.query.GetIterationArtifact, that allows the task to use the artifacts returned by IterationQuery as inputs to the task. In this example custom task, the iteration artifacts are the models in the project.

The build system runs the IterationQuery to determine which artifacts to run the task for. The build system then creates a task iteration, runs additional queries the task needs, runs the task, and saves the task results. For each task iteration, the build system runs the InputQueries to find the inputs for that specific task iteration.

For information on custom tasks, see Create Custom Tasks.

Capabilities and Limitations

This table identifies functionality that is supported by the query.

FunctionalitySupported?

Input query for task

Yes.

Iteration query for task

No.