...
This is useful when creating a grid with products, prices, and total price.
In this section
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Example
Let's set up a grid with products, product prices, and total price. The price and total prices will update after we select a specific product in a grid.
...
Create a Product column that will display our products. This column should be Single Select List type. The column will have these option attributes:
label, default attribute, that will show the names of our products.
price, that will store info about the price of our products.
currency, which will store info about our product currency.
Tip Check the following articles for more information:
How to configure a Single Select List or a Multi Select List column
Add options with products for the Product column. We will enter option attributes we set up earlier, such as price and currency.
Save the column.
Create an Amount column, that will display the amount of products we want to order. It will have a Number column type.
Now, let's create three formula columns:
Price — the price of our product.
Total price — the total price of our products.
Currency — the currency of our order.
Tip Check out How to configure a Formula column for more information.
Each column will have a different formula:
The Price column will reuse the data from the
price
option attribute from the Product column. To do so, we will input the following formula:Code Block language js return $(product).price
Formula parameters:
product
— The Identifier of the Product column.price
— Key of the Price option attribute.The Total price column will multiply the data from the
price
option attribute by the data from the Amount column. To do this, we will use the formula:Code Block language js return $(price) * $(amount)
price
— Identifier of the Price column.amount
— Identifier of the Amount column.The Currency column will display the data from the
currency
option attribute from the Product column. We will use the following formula to do this:Code Block language js return $(product).currency
Formula parameters:
product
— Identifier of the Product column.price
— Key of the Price option attribute.
Result
The following result should look like this:
...
See also
How to configure a Single Select List or a Multi Select List column
...