Formulas in the Edit UI Guide
This guide will help you get started with Formulas.
Start with an Overview
Before you even start it's best to have an overview. The 2sxc 12 Formulas Release Video is a good place to start.
Step 1: Discover Live Examples
🔬 First you must look at the live samples in Formulas Tutorials
If you did this, you should now have seen
What formulas tend to look like
All kinds of things they can affect
That they run in the browser, and keep updating with every interaction
Step 2: Get to Know the Formula Designer
👉 To develop Formulas use the Interactive Formula Designer
Step 3: Try it Yourself
👉 Check out the JS Formula Documentation - also the data and context objects
👉 Also read about the Formula Targets and Return Values
Tips and Tricks
While developing, always keep the F12-Console open to see what's happening
You can always add a
console.log(data, context);
or similar in your code to see in real time what's being processed.You can also add a line
debugger;
and the browser will stop at this line so you can inspect the variables and watch your code.Do use Formulas as pure functions.
Step 4: Go Deeper
You should also check Ephemeral / Temporary Fields as they are very useful together with Formulas.
Know that you can also use webApi calls on the
context.sxc.webApi
to get data from the backend (see tutorials)Also read about the empty-end Field to close a Field-Group as it's useful when grouping fields.
History
- Introduced in 2sxc 12.01
- Extended with
Required
ca. v13.00 - Extended with
Notes
ca. v13.10 - Improve formula designer to allow creating new formulas directly in the designer ca. v14.00
- Added formula designer API help ca. v14.00
- Massively improved v2 Formulas in 2sxc 15.07 (officially released in 16.0)
Shortlink to here: https://go.2sxc.org/formulas