void CalculateGeneralFunctions::EvaluateChoose() { System::SharedPtr project = CreateTestProjectWithCustomField(); // Set Formula project->get_ExtendedAttributes()->idx_get(0)->set_Formula(u"Choose(3, \"This is a\", \"right\", \"choice\")"); // Print extended attribute value System::SharedPtr task = project->get_RootTask()->get_Children()->GetById(1); System::Console::WriteLine(task->get_ExtendedAttributes()->idx_get(0)->get_TextValue()); } void CalculateGeneralFunctions::EvaluateIsNumeric() { System::ArrayPtr numericFormulas = System::MakeArray({u"IsNumeric('AAA')", u"IsNUmeric(1)", u"IsNumeric(1<0)", u"IsNumeric(\"1.1\")", u"IsNumeric(Choose((2 + Sgn(2^-3)), 123, \"one two three\"))"}); System::SharedPtr project = CreateTestProjectWithCustomField(); { for (System::String numericFormula : numericFormulas) { // Set Formula project->get_ExtendedAttributes()->idx_get(0)->set_Formula(numericFormula); // Print extended attribute value System::SharedPtr task = project->get_RootTask()->get_Children()->GetById(1); System::Console::WriteLine(task->get_ExtendedAttributes()->idx_get(0)->get_TextValue()); } } } void CalculateGeneralFunctions::EvaluateSwitch() { System::SharedPtr project = CreateTestProjectWithCustomField(); // Set Formula project->get_ExtendedAttributes()->idx_get(0)->set_Formula(u"Switch( 0 < 1, \"0 is lesser than 1\", 0 > 1, \"0 is greater than 1\")"); // Print extended attribute value System::SharedPtr task = project->get_RootTask()->get_Children()->GetById(1); System::Console::WriteLine(task->get_ExtendedAttributes()->idx_get(0)->get_TextValue()); } System::SharedPtr CalculateGeneralFunctions::CreateTestProjectWithCustomField() { System::SharedPtr project = System::MakeObject(); System::SharedPtr attr = ExtendedAttributeDefinition::CreateTaskDefinition(Aspose::Tasks::CustomFieldType::Text, Aspose::Tasks::ExtendedAttributeTask::Text1, u"Custom Field"); project->get_ExtendedAttributes()->Add(attr); System::SharedPtr task = project->get_RootTask()->get_Children()->Add(u"Task"); System::SharedPtr a = attr->CreateExtendedAttribute(); task->get_ExtendedAttributes()->Add(a); return project; }