Class GraphicalIndicatorCriteriaValue

GraphicalIndicatorCriteriaValue class

Represents a value used in condition check of graphical indicators criteria.

public sealed class GraphicalIndicatorCriteriaValue

Constructors

NameDescription
GraphicalIndicatorCriteriaValue(bool)Creates an instance of GraphicalIndicatorCriteriaValue class with constant flag (bool) value.
GraphicalIndicatorCriteriaValue(DateTime)Creates an instance of GraphicalIndicatorCriteriaValue class with constant DateTime value.
GraphicalIndicatorCriteriaValue(decimal)Creates an instance of GraphicalIndicatorCriteriaValue class with constant decimal value.
GraphicalIndicatorCriteriaValue(Duration)Creates an instance of GraphicalIndicatorCriteriaValue class with constant Duration value.
GraphicalIndicatorCriteriaValue(string)Creates an instance of GraphicalIndicatorCriteriaValue class with constant string value.

Properties

NameDescription
IsFieldLink { get; }Gets whether the current instance is a field link (represents a value of a field).
RawValue { get; }Gets the underlying constant of Field value.

Methods

NameDescription
static CreateFieldLink(Field)Creates an instance of GraphicalIndicatorCriteriaValue class representing the value of the specified MS Project’s field.
override ToString()Returns a string that represents the current object.

Examples

Shows how to retrieve graphical indicators info.

Project project = new Project(DataDir + "graphical_indicators.mpp");

foreach (var ea in project.ExtendedAttributes)
{
    if (ea.GraphicalIndicator == null)
    {
        continue;
    }

    Console.WriteLine("GI for field '{0}':", ea.FieldName);

    foreach (var criterion in ea.GraphicalIndicator.Criteria)
    {
        Console.WriteLine("Row type: {0}", criterion.RowType);
        Console.WriteLine("Image index: {0}", criterion.ImageIndex);
        Console.Write(criterion.Test);
        if (criterion.Value1 != null)
        {
            Console.Write(" ");
            Console.Write(criterion.Value1.RawValue);
        }

        if (criterion.Value2 != null)
        {
            Console.Write(" ");
            Console.WriteLine(criterion.Value2.RawValue);
        }

        Console.WriteLine();
    }
}

Shows how to set up graphical indicator for an extended attribute.

Project project = new Project();

var def = ExtendedAttributeDefinition.CreateTaskDefinition(ExtendedAttributeTask.Number1, "Number field");
project.ExtendedAttributes.Add(def);
def.GraphicalIndicator = new GraphicalIndicatorsInfo();

GraphicalIndicatorCriteria criteria1 = new GraphicalIndicatorCriteria(
    GraphicalIndicatorCriteriaType.SummaryRows,
    FilterComparisonType.IsLessThan,
    2,
    new GraphicalIndicatorCriteriaValue(100m));

// 'IsWithin' criteria requires 2 values.
GraphicalIndicatorCriteria criteria2 = new GraphicalIndicatorCriteria(
    GraphicalIndicatorCriteriaType.SummaryRows,
    FilterComparisonType.IsWithin,
    4,
    new GraphicalIndicatorCriteriaValue(101),
    new GraphicalIndicatorCriteriaValue(1000m));

// 'IsAnyValue' criteria doesn't require values.
GraphicalIndicatorCriteria criteria3 = new GraphicalIndicatorCriteria(
    GraphicalIndicatorCriteriaType.SummaryRows,
    FilterComparisonType.IsAnyValue,
    4,
    null);

def.GraphicalIndicator.Criteria.Add(criteria1);
def.GraphicalIndicator.Criteria.Add(criteria2);
def.GraphicalIndicator.Criteria.Add(criteria3);

def.GraphicalIndicator.ProjectSummaryInheritFromNonSummaryRows = true;
def.GraphicalIndicator.SummaryRowsInheritFromNonSummaryRows = true;
def.GraphicalIndicator.ShowDataValuesInTooltip = false;

project.Save(OutDir + "CreateGraphicalIndicators_out.mpp", SaveFileFormat.Mpp);

See Also