internal static String Execute(String formula, Project project)
 {
     Match separatedFunction = Regex.Match(formula, SQLFunctionPattern);
     String functionName = separatedFunction.Groups[1].Value;
     String functionArguments = separatedFunction.Groups[2].Value;
     GroupCollection arguements;
     IComparable arg1;
     IComparable arg2;
     switch (functionName)
     {
         case "if":
         case "IF":
             arguements = Regex.Match(functionArguments, IfArguementsPattern).Groups;
             String condition = arguements[1].Value;
             if (IsSatisfying(project, condition))
             {
                 return arguements[2].Value;
             }
             return arguements[3].Value;
         case "min":
         case "MIN":
             arguements = Regex.Match(functionArguments, TwoArguementsPattern).Groups;
             try
             {
                 arg1 = (IComparable)project.GetTypedValue(arguements[1].Value);
                 arg2 = (IComparable)project.GetTypedValue(arguements[2].Value);
             }
             catch (InvalidCastException)
             {
                 return "";
             }
             if (arg1.CompareTo(arg2) < 0)
             {
                 return arg1.ToString();
             }
             else
             {
                 return arg2.ToString();
             }
         case "max":
         case "MAX":
             arguements = Regex.Match(functionArguments, TwoArguementsPattern).Groups;
             try
             {
                 arg1 = (IComparable)project.GetTypedValue(arguements[1].Value);
                 arg2 = (IComparable)project.GetTypedValue(arguements[2].Value);
             }
             catch (InvalidCastException)
             {
                 return "";
             }
             if (arg1.CompareTo(arg2) > 0)
             {
                 return arg1.ToString();
             }
             else
             {
                 return arg2.ToString();
             }
         default:
             return "";
     }
 }
        private static bool ResolveFor(Project project, String arg1, String sign, String arg2)
        {
            IComparable var1;
            IComparable var2;
            int comparisonResult;
            try
            {

                var1 = (IComparable)project.GetTypedValue(arg1);
                var2 = (IComparable)project.GetTypedValue(arg2);
                comparisonResult = var1.CompareTo(var2);
            }
            catch (InvalidCastException)
            {
                return true;
            }
            catch (ArgumentException)
            {
                return true;
            }
            catch (NullReferenceException)
            {
                return false;
            }
            if (sign.Contains('=') && !sign.Contains('!'))
            {
                if (sign == "<=")
                {
                    if (comparisonResult < 0)
                    {
                        return true;
                    }
                }
                else if (sign == ">=")
                {
                    if (comparisonResult > 0)
                    {
                        return true;
                    }
                }
                if (comparisonResult == 0)
                {
                    return true;
                }
                return false;
            }
            else
            {
                if (sign == "<" && comparisonResult < 0)
                {
                    return true;
                }
                if (sign == ">" && comparisonResult > 0)
                {
                    return true;
                }
                if (sign == "==" && comparisonResult == 0)
                {
                    return true;
                }
                return false;
            }
        }