# Formula Cheat Sheet & Guide

## How to write formulas for Computed Attributes

Computed Attributes help you transform your attribute outputs for Channels and Brand Portals. In this guide, you will learn how to use the formula editor and what operations are available.

### How to use the Formula Editor

After you have created your Computed Attribute, you can start editing the formula by clicking on the options icon next to the attribute you want to configure.

Once you have done this, you should see this screen slide out from the right side of the page:

In the Formula Editor, you will see a text box. This is where you write your formulas using the available operations, your existing attributes, and text inputs.

Formula syntax, or how a valid formula is written, is based largely on Excel, Google Sheets, and Python.

### How to write a formula

• Use operations
• Enclose operations in parentheses
• Insert properties using the "\$" symbol
• Insert line breaks using CTRL+Enter enclosed in "quotes"

Other Formula Elements:

• \$\$ITEM - This is used to represent a value of a Multiselect attribute. This is used in operations like MAP and FILTER as a placeholder variable that will take the different values of the attribute in a loop execution.
• [Brackets] - These are used in formulas like JOIN or DLOOKUP to represent a set or range of values
• <html> - Elements of HTML can be used in formulas in combination with operations to change the style of an attribute value, for example to add bullets or line breaks.

The formula editor will help you with autosuggest for both operations and attributes. For operations, start typing the name of the operation you want to use. For attributes, start by typing "\$" then the attribute list will appear.

Auto-suggest for Operations

Auto-suggest for Attributes

đĄ  When searching for your own attributes, just type \$ and then the name of your attribute. You do not need to use the ATT prefix.

### How to validate a formula

When you validate a formula, you are asking the system, "Is this formula written correctly?", "Do you understand this?"

To validate a formula, once you are finished editing, click "Validate".

Then, one of two things will happen. Either you will get an error, explaining why the formula isn't correctly written, or you will see the attribute testing area below the Formula Editor

âšī¸ You can also click "Test and Apply" in the top right corner to validate the formula and close the window.

### How to test formula attributes

If your formula has been validated, then you will see this area appear below the Formula Editor, and the Editor will be disabled.

This area lets you test different possible inputs for your Computed Attribute to make sure your formula gives you the correct results.

Attributes without fixed inputs, like numbers or texts, will have dummy data presented, while those with fixed inputs like multi-select or dropdown, will show your existing inputs.

To test attributes:

1. Check or change the data for each attribute so that you can test the outcome
2. Click "Run"
3. Check the result at the bottom of the testing area and repeat the process as needed

### List of Operations

Here are all the available operations listed in alphabetical order. Click each link to take you to the operations page in a new tab where you can see the definition, syntax, and examples.

### What's next?

Is there anything you were hoping to find in this article that is missing? Did this article answer the questions you had? Let us know in our Help Center feedback form! đ

If you have any questions just click on the chat box in the bottom-right corner and we'll be happy to answer them...

and please let us know đ