A custom function registered with StiFunctions becomes available in the dashboard designer's expression editor, alongside the built-in ones.

Implement the function. A public static method does the work:
public static decimal MySum(object value)
{
    if (!ListExt.IsList(value))
        return StiValueHelper.TryToDecimal(value);

    return Funcs.SkipNulls(ListExt.ToList(value)).TryCastToDecimal().Sum();
}
Register it in the static constructor.
StiFunctions.AddFunction(
    "MyCategory", "MySum", "description",
    typeof(DesignerController), typeof(decimal),
    "Calculates a sum of the specified set of values.",
    new[] { typeof(object) }, new[] { "values" }, new[] { "A set of values" }
).UseFullPath = false;

How it works. Once registered, the function appears in the designer's function list and can be called from any dashboard or report expression.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.