Repository navigation
BLL Functions
Method reference · Examples · App settings
Save JavaScript functions in BLL settings and call them by name from BLL expressions in supported apps. This lets several Flows reuse a calculation or text transformation.
- Open BLL app settings, select Functions, enter
doubleand add it. - Edit the new entry.
Save this function under the double entry:
(function (value) {
return value * 2;
})- Use
double(4)in Execute BLL-expression (as Tag). Its number tag is8. Or useDouble: {[ double(4) ]}in supported text.
The function name is configured in the settings list. The code defines the parameters and return value. Deleting or changing it can affect every Flow or app that calls it; check dependencies and test changes.
Create each function under the name shown, then save its function definition.
Name: toFahrenheit
(function (celsius) {
return celsius * 9 / 5 + 32;
})toFahrenheit(20) returns 68. For a formatted message use
Temperature: {[ number(toFahrenheit(20), 1) ]} F.
Name: joinNames
(function (names) {
return names.filter(name => name.trim() !== "").join(", ");
})joinNames(["Kitchen", "", "Garden"]) returns Kitchen, Garden.
This example expects an array of strings.
Name: split3words
(function (s) {
const words = s.split(" ");
return { words: words, splits: [words[0] + " " + words[1], words[2]] };
})JSON.stringify(split3words("hello there friend")) returns JSON containing
the first two words together and the third separately. This example expects
three space-separated words; validate inputs that may differ. It is adapted
from the community example.
Name: appendItem
(function (items, value) {
items.push(value);
return JSON.stringify(items);
})appendItem(["apple", "pear"], "plum") returns JSON text
["apple","pear","plum"]. If input is JSON text, parse it first and handle
invalid JSON. The community discussion
also illustrates an append function.
Only save functions you trust. Do not construct code from untrusted input or put secrets in shared Flow examples. If a function is not found, check its saved name and spelling, and test it first in an expression-only card. Check the result's type before using a corresponding tag.
The following settings screenshot is from the BLL users topic, post 2; the layout may differ in newer versions:
Historical settings screenshot: saved custom functions are listed in BLL.
Historical settings screenshot: the editor shows a function's source.
Support development - If Better Logic Library is useful to you, you can support its
continued development through GitHub Sponsors,
Patreon,
PayPal, or
bunq.
Thank you!

