Class FormulaFunctions
The context supplied while executing custom formulas.
Contains all standard functions provided by StandardFunctions
Inheritance
Implements
Inherited Members
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 |
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
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 |