Search Results for

    Show / Hide Table of Contents

    Class FormulaFunctionsWithContext

    The context supplied while executing formulas that also has a custom context item the formula can execute against

    Inheritance
    System.Object
    StandardFunctions
    FormulaFunctions
    FormulaFunctionsWithContext
    TriggerContext
    FormulaFunctionsWithViewContext
    FormulaFunctionsWithContext<T>
    Implements
    IFormulaFunctionsWithContextItem
    IFormulaFunctions
    Inherited Members
    FormulaFunctions.Data
    FormulaFunctions.Cache
    FormulaFunctions.User
    FormulaFunctions.GetContextItemType(Object)
    FormulaFunctions.GetItemPropertyValue(Object, String)
    FormulaFunctions.GetItemFromDataSourceID(String, String)
    FormulaFunctions.GetItemFromDataSourceID(String, String, String)
    FormulaFunctions.GetItem(String, Guid)
    FormulaFunctions.RunQuery(String, String, String[])
    FormulaFunctions.GetQueryItems(String, String, String, String)
    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 FormulaFunctionsWithContext : FormulaFunctions, IFormulaFunctionsWithContextItem, IFormulaFunctions

    Constructors

    FormulaFunctionsWithContext(IEntityRetriever, IReadOnlyCache, UserInfo, Object)

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

    Declaration
    public FormulaFunctionsWithContext(IEntityRetriever retriever, IReadOnlyCache cache, UserInfo user, object item)
    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

    System.Object item

    The custom item to be used against the formula

    Properties

    Item

    The context item the system is running this formula with

    Declaration
    public IBaseEntity Item { get; }
    Property Value
    Type Description
    IBaseEntity

    Methods

    Create(IEntityRetriever, IReadOnlyCache, UserInfo, Object)

    Creates a new FormulaFunctionsWithContext<T> typed correctly to the type of item to be used as a context against this formula

    Declaration
    public static (Type ContextType, FormulaFunctionsWithContext ContextInstance) Create(IEntityRetriever retriever, IReadOnlyCache cache, UserInfo user, object item)
    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

    System.Object item

    The custom item to be used against the formula

    Returns
    Type Description
    System.ValueTuple<System.Type, FormulaFunctionsWithContext>

    A tuple containing the FormulaFunctionsWithContext and the precise type definition of the context item so it can be parsed and evaluated correctly against formula code referencing MyItem

    GetContextType(EntityDescriptor)

    Returns the exact type of the FormulaFunctionsWithContext that would be created for working against this type of entity, so the the context item can be parsed and evaluated correctly against formula code referencing MyItem

    Declaration
    public static Type GetContextType(EntityDescriptor desc)
    Parameters
    Type Name Description
    EntityDescriptor desc

    The type of entity a formula will be running against

    Returns
    Type Description
    System.Type

    The exact type of the FormulaFunctionsWithContext that would be created for working against this type of entity, so the the context item can be parsed and evaluated correctly against formula code referencing MyItem

    GetValue(String)

    Returns the value of the specified property

    If this is against the item, it is just the value of the property against the item.

    If this is against a query result, the property name is the column name of the value to return
    Declaration
    public virtual object GetValue(string propertyName)
    Parameters
    Type Name Description
    System.String propertyName

    The name of the property to return from the item, or the column name of a sql wrapper result

    Returns
    Type Description
    System.Object

    The value of the specified property

    GetValue<T>(String)

    Declaration
    public virtual T GetValue<T>(string propertyName)
    Parameters
    Type Name Description
    System.String propertyName
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T

    ItemAs<T>()

    The context item the system is running this formula with

    Declaration
    public T ItemAs<T>()
    Returns
    Type Description
    T

    The context item the system is running this formula with

    Type Parameters
    Name Description
    T

    The type of this context item

    Implements

    IFormulaFunctionsWithContextItem
    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

    FormulaFunctionsWithContext<T>
    FormulaFunctions
    In This Article
    Back to top © LemonEdge Technology. All rights reserved.