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
creates a query for getting the current task iteration artifact.query
= padv.builtin.query.GetIterationArtifact()
Properties
Title
— Query title
"Current iteration artifact"
(default) | string | character vector
Query title, specified as a string or a character vector.
Example: "Get artifact that task is iterating over"
Data Types: char
| string
Parent
— Initial query that runs before iteration query
padv.Query
| Name
of padv.Query
object
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"
Name
— Unique identifier for query
"padv.builtin.query.GetIterationArtifact"
(default) | string
Unique identifier for query, specified as a string.
Example: "FindCurrentIterationArtifact"
Data Types: string
ShowFileExtension
— Show file extensions for returned artifacts
0
(false
) | 1
(true
)
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
SortArtifacts
— Setting for automatically sorting artifacts by address
true
or 1
(default) | false
or 0
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
FunctionHandle
— Handle to function that function-based query runs
function_handle
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
Specialized Public Methods
This class overrides the following inherited methods.
run | Run query to find the artifacts that meet the criteria specified by the query. The query returns a Note You do not need to manually invoke this method inside your process model.
The build system automatically invokes the
The function artifact = run(~,iterationArtifact) artifact = iterationArtifact; end |
Examples
Get Current Task Iteration Artifact for Task
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.
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
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.
Functionality | Supported? |
---|---|
Input query for task | Yes. |
Iteration query for task | No. |
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)