Main Content

addQuery

Add query instance to process model

    Description

    queryObj = addQuery(pm,queryNameOrInstance) adds the query specified by queryNameOrInstance to the process model. You can access the query using the query object queryObj.

    This functionality requires CI/CD Automation for Simulink Check.

    queryObj = addQuery(___,Name=Value) specifies the properties of the query using one or more Name=Value arguments.

    Input Arguments

    collapse all

    Process for project, specified as a padv.ProcessModel object.

    Example: pm = padv.ProcessModel

    Name or instance of a query, specified as a string or padv.Query object.

    Example: "NameOfMyQuery"

    Example: padv.builtin.query.FindModels

    Name-Value Arguments

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example:

    Artifact type returned by the query, specified as a valid value for the Type property of a padv.Artifact object.

    Example: DefaultArtifactType = "sl_model_file"

    Human readable name for the query, specified as a string. By default, the Title property of the query is the same as the Name.

    Example: Title = "My Query"

    Data Types: string

    Handle to function that runs when you run query object, specified as a function_handle.

    When you call the run function on a query object, run runs the function specified by the function_handle.

    Example: FunctionHandle = @FunctionForQuery

    Data Types: function_handle

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

    For example, the built-in querypadv.builtin.query.FindModelsWithTestCases has the Parent query padv.builtin.query.FindModels. If you specify padv.builtin.query.FindModelsWithTestCases as the iteration query for a task, you are specifying that you want the task to run once for each model with a test case. The build system runs the Parent query padv.builtin.query.FindModels first, to find the models in the project, and then the build system runs the iteration query padv.builtin.query.FindModelsWithTestCases to find the models with test cases.

    The build system ignores the Parent query when you specify a query as an input query or dependency query for a task.

    Example: Parent = "padv.builtin.query.FindModels"

    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 more information, 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 function. The sortArtifacts method should return a list of sorted padv.Artifact objects.

    Example: SortArtifacts = false

    Data Types: logical

    Output Arguments

    collapse all

    Query object, returned as a padv.Query object.

    For more information, see padv.Query.