🪄 Intro to Formulas
504
There are two types of Formulas in WeWeb:
- the formulas you create, and
- no-code formulas we provide out of the box.
Formulas You Create
If you go to "Data" > "Formulas", you will see you can create and organize formulas in the same way you might write functions if you were coding an app.
In the example below, we created a formula to convert numbers using a Javascript custom code:
We can then reuse it throughout our project, keeping in mind that it needs a number parameter:
Out-of-the-Box No-code Formulas
There are many no-code formulas available out-of-the-box, including but not limited to formulas to:
- format a text (uppercase, capitalize)
- convert a variable (toText, toNumber),
- return true or false if a variable is empty (ifEmpty),
- find items in a list that match a value (filterByKey),
- make calculations (sum, average, round, rollupSum),
- create an array or object (createArray, createObject), and
- find items in list B based on a value in list A (lookupArray).
Whenever you bind an item, you can find WeWeb's no-code formulas in the Formula tab:
These formulas are ordered by category:
- conditional,
- math,
- array,
- text,
- object,
- date,
- file, and
- utilities.
Note that you can also find:
- all the formulas you created in the "Custom" category, and
- common operators in the "Operators" category.
🔥 Pro Tip 🔥
You can learn more about every no-code formula in the WeWeb editor when you hover over the formula name in the formula tab or the formula input field.