Main Content

applyStatus

Apply new task status if priority is higher

    Description

    applyStatus(resultObj,taskStatus) applies a new task status taskStatus to the task result object resultObj if the priority level of taskStatus is higher than the current Status property of the task result object.

    This function requires CI/CD Automation for Simulink Check.

    The priority levels from lowest to highest are:

    • padv.TaskStatus.Pass

    • padv.TaskStatus.Fail

    • padv.TaskStatus.Error

    Note

    The function applyStatus can only change the Status to a higher priority status. For example, if you apply a failing status and then apply a passing status, the status remains a failing status because the priority of padv.TaskStatus.Fail is higher than the priority of padv.TaskStatus.Pass.

    taskResult = padv.TaskResult(); % By default, Status is Pass.
    applyStatus(taskResult, padv.TaskStatus.Fail); % Status changes to Fail.
    applyStatus(taskResult, padv.TaskStatus.Pass); % Status remains Fail.
    taskResult
    taskResult = 
    
      TaskResult with properties:
    
                 Status: Fail
        OutputArtifacts: [0×0 padv.Artifact]
                Details: [1×1 struct]
                 Values: [1×1 struct]
           ResultValues: [1×1 struct]

    To set the Status property of a task result object to a specific value, manually set the property to either padv.TaskStatus.Pass, padv.TaskStatus.Fail, or padv.TaskStatus.Error. For example, to set the Status of a task result object taskResult to Pass, use taskResult.Status = padv.TaskStatus.Pass.

    example

    Examples

    collapse all

    Use applyStatus to update the Status property of a task result object. If the status is a higher priority status, applyStatus updates the Status property of the task result object.

    Create a task result object. By default, the Status property of the task result object is specified as Pass.

    taskResult = padv.TaskResult();

    Suppose the task needs to generate an error. Use applyStatus to apply an error task status, specified by padv.TaskStatus.Error.

    applyStatus(taskResult,padv.TaskStatus.Error);
    padv.TaskStatus.Error has a higher priority than a passing task status, so applyStatus updates the Status property of the task result object.

    Apply a passing task status to the task result object. A passing task status is specified by padv.TaskStatus.Pass.

    applyStatus(taskResult,padv.TaskStatus.Pass);
    padv.TaskStatus.Pass does not have a higher priority than an error task status, so applyStatus does not change the Status of the task result object.

    Inspect the properties of the task result object.

    taskResult

    Suppose you want to reset the status of the task result object to a passing task status. Manually specify the Status property as padv.TaskStatus.Pass.

    taskResult.Status = padv.TaskStatus.Pass
    taskResult = 
    
      TaskResult with properties:
    
                 Status: Pass
        OutputArtifacts: [0×0 padv.Artifact]
                Details: [1×1 struct]
                 Values: [1×1 struct]
           ResultValues: [1×1 struct]
    The task result object now has a passing task status.

    Input Arguments

    collapse all

    Task result object, specified as a padv.TaskResult object.

    Task status, specified as padv.TaskStatus.Pass, padv.TaskStatus.Fail, or padv.TaskStatus.Error.

    Example: padv.TaskStatus.Fail