Main Content

setComplianceCount

Set number of results with specified compliance status

    Description

    setComplianceCount(taskResultObj,status,count) specifies the number of assessment results, count, that have the specified compliance status, status, in the ComplianceStatusSummary property in the task result object.

    This function sets the count by overwriting the existing value. If you want to add to the existing value, you can use the function addComplianceStatus instead.

    example

    Examples

    collapse all

    As part of your task definition, you can set the compliance status information to the task results by using the setComplianceCount function.

    Create a task result by using a padv.TaskResult object.

    taskResult = padv.TaskResult;

    View the compliance status summary. By default, there are no compliant, warning, and non-compliant statuses in the task result because the task assessment has not run yet.

    taskResult.ComplianceStatusSummary
    ans =
    
      dictionary (padv.ComplianceStatus ⟼ uint64) with 3 entries:
    
        Compliant    ⟼ 0
        Warning      ⟼ 0
        NonCompliant ⟼ 0

    Suppose that your task assessment identifies one compliant result, two warnings, and three non-compliant results. You can update the compliance statuses in the task result by using the setComplianceCount function.

    setComplianceCount(taskResult,"Compliant",1);
    setComplianceCount(taskResult,"Warning",2);
    setComplianceCount(taskResult,"NonCompliant",3);

    Verify the current compliance status summary of the task result by checking the ComplianceStatusSummary property value.

    taskResult.ComplianceStatusSummary
    ans =
    
      dictionary (padv.ComplianceStatus ⟼ uint64) with 3 entries:
    
        Compliant    ⟼ 1
        Warning      ⟼ 2
        NonCompliant ⟼ 3

    To access a specific entry in the dictionary, you can use the key associated with the value that you want to look up. For example, find the number of non-compliant assessment results.

    taskResult.ComplianceStatusSummary("NonCompliant")
    ans =
    
      uint64
    
       3

    Input Arguments

    collapse all

    Task result, specified as a padv.TaskResult object.

    Example: padv.TaskResult

    Compliance status, specified as either:

    • padv.ComplianceStatus.Compliant — The task meets the assessment objective.

    • padv.ComplianceStatus.Warning — The task might not meet the assessment objective and needs review.

    • padv.ComplianceStatus.NonCompliant — The task does not meet the assessment objective.

    These values belong to the enumeration class padv.ComplianceStatus.

    Example: padv.ComplianceStatus.NonCompliant

    Number of assessment results, specified as an integer.

    Example: 2

    Data Types: double