Repository navigation
BLL Coding
Home · Flow cards · Formatting · Supported apps
In a text argument explicitly supported by BLL or another app, wrap each
JavaScript expression in {[ ... ]}. The app decodes it and substitutes its
result into the text:
Today is {[ date("dddd") ]}.
Last item: {[ _.last(["one", "two"]) ]}
Rounded: {[ math.round(3.14159, 2) ]}
The last two examples use Lodash as _ and Math.js as math. The Coding
page in app settings includes live examples. Multiple expressions may appear
in one supported text value. If an expression stays literal, verify that BLL
is installed and running, the specific field is decoded, and the syntax is
valid. Some text-decoding errors can leave the original text unchanged.
Execute BLL-expression, Execute BLL-expression (as Tag) and the
BLL expression condition take the expression itself, without {[ ]}:
math.round(3.14159, 2)An action can save the result to a variable or expose result tags. A condition
should produce a boolean, for example 2 + 3 > 4. Execute Text (as Tag)
instead takes ordinary text with embedded {[ ... ]}. Do not confuse these
two forms.
BLL coding provides date, time, number, now, _, math and
functions defined in settings. now is the current time in milliseconds,
captured at the start of an evaluation. Formatting examples are in
Formatting.
In app settings, open Functions, enter a name such as double, add and
edit it. Save a JavaScript function definition, for example:
function (value) {
return value * 2;
}Use double(4) in an expression-only card or {[ double(4) ]} in supported
text. Functions are shared by BLL expressions, so changing or deleting one
can affect multiple Flows and apps. Use code you trust and avoid putting
secrets in expressions or shared function definitions.
The older Math.js expression action and condition are separate from
JavaScript BLL expressions. They substitute BLL variable names between dollar
signs before evaluating the Math.js expression. For example, with a number
variable DoorCount:
$DoorCount$ + 1
$DoorCount$ > 10
Use the first in the Math.js action and the second in its condition. Special
values include $#timenow$ in seconds and $#timestamp$ in milliseconds;
$timenow$ is also supported. Missing variable names cause an error.
Do not assume $name$ syntax works in BLL JavaScript expressions.
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!