Search Results for

    Show / Hide Table of Contents

    Class FormulaFunctions

    The context supplied while executing custom formulas.

    Contains all standard functions provided by StandardFunctions

    Inheritance
    System.Object
    StandardFunctions
    FormulaFunctions
    FormulaFunctionsWithContext
    FormulaFunctionsWithQueryRunnerResults
    ImporterFormulaContext
    Implements
    IFormulaFunctions
    Inherited Members
    StandardFunctions.FormatAsString(Object)
    StandardFunctions.Null()
    StandardFunctions.IsNull(Object)
    StandardFunctions.Not(Boolean)
    StandardFunctions.Or(Boolean, Boolean)
    StandardFunctions.And(Boolean, Boolean)
    StandardFunctions.Sin(Double)
    StandardFunctions.Cos(Double)
    StandardFunctions.Now()
    StandardFunctions.Today()
    StandardFunctions.TodayString()
    StandardFunctions.EndOfMonth(DateTime)
    StandardFunctions.BeginningOfMonth(DateTime)
    StandardFunctions.BeginningOfWeek(DateTime)
    StandardFunctions.EndOfYear(DateTime)
    StandardFunctions.EndOfDay(DateTime)
    StandardFunctions.Floor(Decimal)
    StandardFunctions.Ceiling(Decimal)
    StandardFunctions.BeginningOfYear(DateTime)
    StandardFunctions.BeginningOfDay(DateTime)
    StandardFunctions.Random(Int32, Int32)
    StandardFunctions.Trim(String)
    StandardFunctions.TrimStart(String, Char[])
    StandardFunctions.TrimEnd(String, Char[])
    StandardFunctions.PadLeft(String, Int32, Char)
    StandardFunctions.PadRight(String, Int32, Char)
    StandardFunctions.Mod(Double, Double)
    StandardFunctions.If(Boolean, Object, Object)
    StandardFunctions.IsIn(Object, Object)
    StandardFunctions.IsIn(Object, Object, Object)
    StandardFunctions.IsIn(Object, Object, Object, Object)
    StandardFunctions.IsIn(Object, Object, Object, Object, Object)
    StandardFunctions.IsIn(Object, Object, Object, Object, Object, Object)
    StandardFunctions.IsIn(Object, Object, Object, Object, Object, Object, Object)
    StandardFunctions.IsIn(Object, Object, Object, Object, Object, Object, Object, Object)
    StandardFunctions.IsIn(Object, Object, Object, Object, Object, Object, Object, Object, Object)
    StandardFunctions.IsIn(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
    StandardFunctions.IsIn(Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.SelectCase(Object, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>, Func<Task<Object>>)
    StandardFunctions.Format(Object, String)
    StandardFunctions.Lower(String)
    StandardFunctions.Upper(String)
    StandardFunctions.WCase(String)
    StandardFunctions.Date(Int32, Int32, Int32)
    StandardFunctions.Year(DateTime)
    StandardFunctions.Month(DateTime)
    StandardFunctions.Day(DateTime)
    StandardFunctions.WeekDay(DateTime)
    StandardFunctions.Replace(String, String, String)
    StandardFunctions.Substr(String, Int32, Int32)
    StandardFunctions.Len(String)
    StandardFunctions.Abs(Double)
    StandardFunctions.Int(Object)
    StandardFunctions.Trunc(Double, Int32)
    StandardFunctions.Dec(Object)
    StandardFunctions.Round(Object)
    StandardFunctions.IsBlank(String)
    StandardFunctions.Round(Object, Int32)
    StandardFunctions.Min(Double, Double, Double, Double, Double)
    StandardFunctions.Max(Double, Double, Double, Double, Double)
    StandardFunctions.Chr(Int32)
    StandardFunctions.ChCR()
    StandardFunctions.ChLF()
    StandardFunctions.ChCRLF()
    StandardFunctions.Money(Object)
    StandardFunctions.Contains(String, String)
    StandardFunctions.FormatDate(DateTime, String)
    StandardFunctions.Sqrt(Double)
    StandardFunctions.Power(Double, Double)
    StandardFunctions.ValString(Object)
    StandardFunctions.ValBool(Object)
    StandardFunctions.ValDate(Object)
    StandardFunctions.ValDecimal(Object)
    StandardFunctions.ValLong(Object)
    StandardFunctions.ValID(Object)
    StandardFunctions.DateAdd(DateTime, Decimal, Decimal, Decimal)
    StandardFunctions.DateAddWorkDays(DateTime, Decimal)
    StandardFunctions.DateAdd(DateTime, DateTime)
    StandardFunctions.DayDifference(DateTime, DateTime)
    StandardFunctions.DayDifferenceWorkDays(DateTime, DateTime)
    StandardFunctions.HourDifference(DateTime, DateTime)
    StandardFunctions.MinuteDifference(DateTime, DateTime)
    StandardFunctions.YearDifference(DateTime, DateTime)
    StandardFunctions.NullDate()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: LemonEdge.Core
    Assembly: API.dll
    Syntax
    public class FormulaFunctions : StandardFunctions, IFormulaFunctions

    Constructors

    FormulaFunctions(IEntityRetriever, IReadOnlyCache, UserInfo)

    Creates a new formula functions for helping with custom formulas as a context to operate against

    Declaration
    public FormulaFunctions(IEntityRetriever retriever, IReadOnlyCache cache, UserInfo user)
    Parameters
    Type Name Description
    IEntityRetriever retriever

    A context allowing formulas to load and query any data from LemonEdge

    IReadOnlyCache cache

    A local cache

    UserInfo user

    The current user executing the formula

    Properties

    Cache

    A local cache for retrieving already loaded standing data

    Declaration
    public IReadOnlyCache Cache { get; }
    Property Value
    Type Description
    IReadOnlyCache

    Data

    A context that allows you to retrieve and query any data from the LemonEdge system for evaluation

    Declaration
    public IEntityRetriever Data { get; }
    Property Value
    Type Description
    IEntityRetriever

    User

    The current user running the formula

    Declaration
    public UserInfo User { get; }
    Property Value
    Type Description
    UserInfo

    Methods

    GetContextItemType(Object)

    Returns the entity name of the type this item is

    Declaration
    public string GetContextItemType(object source)
    Parameters
    Type Name Description
    System.Object source

    An item to return the name of the type for

    Returns
    Type Description
    System.String

    The name of the type this item is

    Remarks

    This is the name of the entity type as defined in the ItemName attribute property

    GetItem(String, Guid)

    Returns an instance of the specified object type from its id

    Declaration
    public Task<IBaseEntity> GetItem(string typeName, Guid id)
    Parameters
    Type Name Description
    System.String typeName

    The entity type name (as defined in ItemName attribute property) of the type of object to return

    System.Guid id

    The id of the item to return

    Returns
    Type Description
    System.Threading.Tasks.Task<IBaseEntity>

    GetItemFromDataSourceID(String, String)

    Returns the id of the specified object a matching value of the specified data source key.

    Declaration
    public Task<Guid?> GetItemFromDataSourceID(string datasourceTypeName, string datasourceID)
    Parameters
    Type Name Description
    System.String datasourceTypeName

    The name of the data source type you are providing a key value to search for

    System.String datasourceID

    The value of the data source key to search for and return the matching entity of

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Nullable<System.Guid>>

    The id of the specified object a matching value of the specified data source key

    GetItemFromDataSourceID(String, String, String)

    Returns the id of the specified object a matching value of the specified data source key.

    Declaration
    public Task<Guid?> GetItemFromDataSourceID(string typeName, string datasourceTypeName, string datasourceID)
    Parameters
    Type Name Description
    System.String typeName

    The name of the type you want to return an id of

    System.String datasourceTypeName

    The name of the data source type you are providing a key value to search for

    System.String datasourceID

    The value of the data source key to search for and return the matching entity of

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Nullable<System.Guid>>

    The id of the specified object a matching value of the specified data source key

    GetItemPropertyValue(Object, String)

    Returns the value for a specifid propName against an item

    Declaration
    public object GetItemPropertyValue(object item, string propName)
    Parameters
    Type Name Description
    System.Object item

    The item to return the value of the specified property from

    System.String propName

    The property to return the value from

    Returns
    Type Description
    System.Object

    The value for a specifid propName against an item

    GetQueryItems(String, String, String, String)

    Executes the specified ISQLWrapper and returns all the results. You can use the SQLWrapperInterpretor helper class for evaluating the results

    Declaration
    public Task<ISQLWrapperResult[]> GetQueryItems(string queryName, string parameters, string filter, string orderBy)
    Parameters
    Type Name Description
    System.String queryName

    The name of the ISQLWrapper to execute

    System.String parameters

    Any parameters for executing the query in the form: @ParamName1=value1, @ParamName2=value2, ...

    System.String filter

    A filter of the form XXX OP Value. See ParseWhere(Type, String)

    System.String orderBy

    Comma separated order by ascending/descending. See ParseSort(String, Func<String, String>)

    Returns
    Type Description
    System.Threading.Tasks.Task<ISQLWrapperResult[]>
    See Also
    SQLWrapperInterpretor

    RunQuery(String, String, String[])

    Executes the specified ISQLWrapper and returns the value of the specified column from the first result

    Declaration
    public Task<object> RunQuery(string queryName, string columnName, params string[] parameters)
    Parameters
    Type Name Description
    System.String queryName

    The name of the ISQLWrapper to execute

    System.String columnName

    The column Name in the SQLWrapper to return the value of

    System.String[] parameters

    Any parameters for executing the query in the form: @ParamName1=value1, @ParamName2=value2, ...

    Returns
    Type Description
    System.Threading.Tasks.Task<System.Object>

    The value of the specified column from the first result of executing the SQLWrapper

    Implements

    IFormulaFunctions

    Extension Methods

    MiscExtensions.SetIfNotEqual<T, P>(T, Expression<Func<T, P>>, P)
    ReflectionExtensions.ClearEventInvocations(Object, String)
    StringExtensions.ToCSVFormatString(Object, Type)
    SQLExtensions.ToSQLValue(Object, Boolean)

    See Also

    IFormulaFunctions
    In This Article
    Back to top © LemonEdge Technology. All rights reserved.