Search Results for

    Show / Hide Table of Contents

    Class FormulaFunctionsWithContext<T>

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

    Inheritance
    object
    StandardFunctions
    FormulaFunctions
    FormulaFunctionsWithUpdater
    FormulaFunctionsWithContext<T>
    BlendTransactionContext
    TransactionContext
    DatasetShortcutFormulaContext
    FormulaFunctionsWithContext
    FormulaFunctionsWithContextAndStorage<T>
    NotificationContext
    FormulaFunctionsWithViewModel<T>
    AlgorithmContext
    Implements
    IFormulaFunctionsWithContext<T>
    IFormulaFunctionsWithContext
    IFormulaFunctions
    Inherited Members
    FormulaFunctionsWithUpdater.SetCustomParameters(Dictionary<string, object>)
    FormulaFunctionsWithUpdater.CreateNewData()
    FormulaFunctionsWithUpdater.CreateNewItem(string)
    FormulaFunctionsWithUpdater.CreateNewItem<T>()
    FormulaFunctionsWithUpdater.GetCustomParamValue(string)
    FormulaFunctionsWithUpdater.HasCustomParamValue(string)
    FormulaFunctionsWithUpdater.HasCustomParamValueEqualTo(string, object)
    FormulaFunctionsWithUpdater.RunCodeSnippet(string, params string[])
    FormulaFunctionsWithUpdater.MyData
    FormulaFunctions.ShareThisQueryCacheWithTarget(IFormulaFunctions)
    FormulaFunctions.SetQueryRunnerHelper(Func<IEntityUpdater, ISQLWrapperInterpretor, Dictionary<string, string>, QueryableExecuter<ISQLWrapperResult>, Task<DataRow[]>>)
    FormulaFunctions.GetItemPropertyValue(object, string)
    FormulaFunctions.GetTaskID(string)
    FormulaFunctions.GetTaskParameter(string)
    FormulaFunctions.SetObjectValue(object, string, object)
    FormulaFunctions.GetObjectValue(object, string)
    FormulaFunctions.GetExtendedPropertyValue(IBaseEntity, string, string)
    FormulaFunctions.GetExtendedPropertyItem(IBaseEntity, string)
    FormulaFunctions.GetExtendedObject(IBaseEntity, string, bool)
    FormulaFunctions.GetEntityTypeID(string)
    FormulaFunctions.Evaluate<T>(string, bool)
    FormulaFunctions.IsValid<T>(string)
    FormulaFunctions.IsValid<T>(string, Type)
    FormulaFunctions.GetContextItemType(object)
    FormulaFunctions.GetItemFromDataSourceID(string, string)
    FormulaFunctions.GetItemFromDataSourceID(string, string, string)
    FormulaFunctions.GetItem(string, Guid)
    FormulaFunctions.GetItemAs<T>(Guid)
    FormulaFunctions.GetItems(string, QueryableFilter)
    FormulaFunctions.GetFirstOrDefaultItem(string, QueryableFilter)
    FormulaFunctions.GetItems(string, string, SQLOperator, object)
    FormulaFunctions.GetFirstOrDefaultItem(string, string, SQLOperator, object)
    FormulaFunctions.GetItems<T>(QueryableFilter)
    FormulaFunctions.GetFirstOrDefaultItem<T>(QueryableFilter)
    FormulaFunctions.GetItems<T>(string, SQLOperator, object)
    FormulaFunctions.GetFirstOrDefaultItem<T>(string, SQLOperator, object)
    FormulaFunctions.GetEnumValue(object)
    FormulaFunctions.GetEnumCode(object)
    FormulaFunctions.XIRR(string, string, string, params string[])
    FormulaFunctions.XIRR(string, string, string, (string, object)[], params string[])
    FormulaFunctions.TWR(string, string, string, string, params string[])
    FormulaFunctions.TWRRow(string, string, string, string, params string[])
    FormulaFunctions.RunQuery(string, string, params string[])
    FormulaFunctions.HasQueryResult(string, params string[])
    FormulaFunctions.GetQueryResult(ISQLWrapperResult, string)
    FormulaFunctions.GetQueryResult(DataRow, string)
    FormulaFunctions.GetQueryResult(string, string, ISQLWrapperResult)
    FormulaFunctions.GetQueryResult(string, string, DataRow)
    FormulaFunctions.GetQueryResult(string, string, ISQLWrapperResult[], string, object)
    FormulaFunctions.RunQueryResult(string, params string[])
    FormulaFunctions.RunDRQueryResult(string, params string[])
    FormulaFunctions.LogInfo(string, params object[])
    FormulaFunctions.LogError(Exception, string, params object[])
    FormulaFunctions.GetQueryCount(string, string, string)
    FormulaFunctions.GetQueryItems(string, string, string, string)
    FormulaFunctions.GetDRQueryItems(string, string, string, string)
    FormulaFunctions.Data
    FormulaFunctions.Cache
    FormulaFunctions.Services
    FormulaFunctions.User
    StandardFunctions.FormatAsString(object)
    StandardFunctions.Null()
    StandardFunctions.IsNull(object)
    StandardFunctions.Not(bool)
    StandardFunctions.Or(bool, bool)
    StandardFunctions.And(bool, bool)
    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(int, int)
    StandardFunctions.Trim(string)
    StandardFunctions.TrimStart(string, char[])
    StandardFunctions.TrimEnd(string, char[])
    StandardFunctions.PadLeft(string, int, char)
    StandardFunctions.PadRight(string, int, char)
    StandardFunctions.Mod(double, double)
    StandardFunctions.If(bool, 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(int, int, int)
    StandardFunctions.Year(DateTime)
    StandardFunctions.Month(DateTime)
    StandardFunctions.Day(DateTime)
    StandardFunctions.WeekDay(DateTime)
    StandardFunctions.Replace(string, string, string)
    StandardFunctions.Substr(string, int, int)
    StandardFunctions.Len(string)
    StandardFunctions.Abs(double)
    StandardFunctions.Int(object)
    StandardFunctions.Trunc(double, int)
    StandardFunctions.Dec(object)
    StandardFunctions.Round(object)
    StandardFunctions.IsBlank(string)
    StandardFunctions.Round(object, int)
    StandardFunctions.Min(double, double, double, double, double)
    StandardFunctions.Max(double, double, double, double, double)
    StandardFunctions.Chr(int)
    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.ValDateTimeOffset(object)
    StandardFunctions.ValDecimal(object)
    StandardFunctions.ValLong(object)
    StandardFunctions.ValID(object)
    StandardFunctions.DateAdd(DateTime, decimal, decimal, decimal)
    StandardFunctions.DateAdd(DateTimeOffset, 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()
    StandardFunctions.NullDateTimeOffset()
    StandardFunctions.TempValue1
    object.GetType()
    object.MemberwiseClone()
    object.ToString()
    object.Equals(object)
    object.Equals(object, object)
    object.ReferenceEquals(object, object)
    object.GetHashCode()
    Namespace: LemonEdge.API.Core.Formulas
    Assembly: LemonEdge.API.dll
    Syntax
    public class FormulaFunctionsWithContext<T> : FormulaFunctionsWithUpdater, IFormulaFunctionsWithContext<T>, IFormulaFunctionsWithContext, IFormulaFunctions
    Type Parameters
    Name Description
    T The context supplied while executing formulas that also has a custom context item the formula can execute against

    Constructors

    FormulaFunctionsWithContext(IEntityRetriever, IReadOnlyCache, UserInfo, T, IFormulaFunctionsServiceContext)

    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, T item, IFormulaFunctionsServiceContext services)
    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

    T item

    The custom item to be used against the formula

    IFormulaFunctionsServiceContext services

    The core services demanded from the IServiceProvider

    Properties

    ChangedItemType

    Declaration
    public ContextChangedItemType ChangedItemType { get; set; }
    Property Value
    Type Description
    ContextChangedItemType

    Item

    Required when MyItem is an unknown type to the user but definitely an IBaseEntity

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

    MyItem

    The context item the system is running this formula with

    Declaration
    public T MyItem { get; init; }
    Property Value
    Type Description
    T

    PropertyChangedAlias

    Declaration
    public string PropertyChangedAlias { get; set; }
    Property Value
    Type Description
    string

    PropertyChangedItem

    Declaration
    public IBaseEntity PropertyChangedItem { get; set; }
    Property Value
    Type Description
    IBaseEntity

    PropertyChangedName

    Declaration
    public string PropertyChangedName { get; set; }
    Property Value
    Type Description
    string

    Methods

    CreateFormulaContext(Type)

    Declaration
    protected override FormulaFunctions CreateFormulaContext(Type ofType)
    Parameters
    Type Name Description
    Type ofType
    Returns
    Type Description
    FormulaFunctions
    Overrides
    FormulaFunctionsWithUpdater.CreateFormulaContext(Type)

    GetAnswerTotal(string)

    Returns the total of answers against this object for the specified question type

    Declaration
    [FormulaFunction(Name = "GetAnswerTotal", Type = "Main", Description = "Returns the total of answers against this object for the specified question type.", Params = "1. The name of the question type.", ParamCount = 1, IsAsync = true)]
    public Task<decimal> GetAnswerTotal(string forQuestionTypeName)
    Parameters
    Type Name Description
    string forQuestionTypeName

    The name of the question type

    Returns
    Type Description
    Task<decimal>

    The total of answers against this object for the specified question type

    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
    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
    [FormulaFunction(Name = "GetValue", Type = "Main", Description = "Returns the value of the specified property. Can also be called with GetValusAs<Type>.", Params = "1. The name of the property to return from the item, or the column name of a sql wrapper result.", ParamCount = 1, IsAsync = false)]
    public virtual object GetValue(string propertyName)
    Parameters
    Type Name Description
    string propertyName

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

    Returns
    Type Description
    object

    The value of the specified property

    GetValue<T2>(string)

    Declaration
    public virtual T2 GetValue<T2>(string propertyName)
    Parameters
    Type Name Description
    string propertyName
    Returns
    Type Description
    T2
    Type Parameters
    Name Description
    T2

    ItemAs<T1>()

    Declaration
    public T1 ItemAs<T1>()
    Returns
    Type Description
    T1
    Type Parameters
    Name Description
    T1

    SetBusy(string)

    Allow override in ui, but don't do anything in services

    Declaration
    public virtual void SetBusy(string label)
    Parameters
    Type Name Description
    string label

    SetExtendedPropertyValue(IBaseEntity, string, string, object)

    Declaration
    [FormulaFunction(Name = "SetExtendedPropertyValue", Type = "Main", Description = "Sets the value for the specified item for a extended custom property of it.", Params = "1. The main item to update an extended property for.\r\n2. The name of the extended custom entity.\r\n3. The name of the of the property on the extended type to update.\r\n4. The value to update the property with.", ParamCount = 4, IsAsync = true)]
    public virtual Task<IBaseEntity> SetExtendedPropertyValue(IBaseEntity item, string extendedTypeName, string extendedPropertyName, object value)
    Parameters
    Type Name Description
    IBaseEntity item
    string extendedTypeName
    string extendedPropertyName
    object value
    Returns
    Type Description
    Task<IBaseEntity>

    StopBusy()

    Allow override in ui, but don't do anything in services

    Declaration
    public virtual void StopBusy()

    TestEvents()

    Declaration
    public Task TestEvents()
    Returns
    Type Description
    Task

    Implements

    IFormulaFunctionsWithContext<T>
    IFormulaFunctionsWithContext
    IFormulaFunctions

    Extension Methods

    LinqExtensions.AsArray<T>(T)
    LinqExtensions.ToArrayOfOne<T>(T)
    LinqExtensions.ToListOfOne<T>(T)
    MiscExtensions.SetIfNotEqual<T, TP>(T, Expression<Func<T, TP>>, TP)
    WeakReferenceExtensions.WeakReference(object)
    SQLExtensions.ToSQLValue(object, bool)
    ReflectionExtensions.ClearEventInvocations(object, string)
    StringExtensions.ToCSVFormatString(object, Type)

    See Also

    FormulaFunctionsWithContext<T>
    FormulaFunctions
    In this article
    Back to top © LemonEdge Technologies. All rights reserved.