Aspose.Tasks.Examples.CSharp.WorkingWithFormulas.UsingTaskNumberFields.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:UsingTaskNumberFields
            Project project = CreateTestProjectWithCustomField();

            // Set formula
            ExtendedAttributeDefinition attr = project.ExtendedAttributes[0];
            attr.Alias = "Task number fields";
            attr.Formula = "([Outline Level] + [Priority] + [% Complete])/2";

            Task task = project.RootTask.Children.GetById(1);

            // Print extended attribute value before and after updating task percent complete
            Console.WriteLine(task.ExtendedAttributes[0].Value);
            task.Set(Tsk.PercentComplete, 50);
            Console.WriteLine(task.ExtendedAttributes[0].Value);
            // ExEnd:UsingTaskNumberFields
        }