Description
The format
function is used to format a value within the list view. The first parameter must be the value to be formatted (or a formula). With the second parameter, a prefix can be set, and with the third parameter, a suffix can be set. The fourth parameter is used to select the color of the text content. Additionally, a sortvalue
parameter can be provided as a custom comparison value for sorting operations.
Syntax
format(expression, prefix, suffix, color, sortvalue)
Arguments
Argument | Description |
expression | The value or expression to be formatted. |
prefix (optional) | A text to be displayed before the expression. |
suffix (optional) | A text to be displayed after the expression. |
color (optional) | The color of the text content. For example: "red" , "blue" . |
sortvalue (optional) | A value used for sorting operations, instead of the displayed formatted text. |
Return Types
The function returns the formatted text based on the specified parameters for prefix, suffix, and color.
Example
format(cost, "Cost: ", "$", "red")
The example call format(cost, "Cost: ", "$", "red")
formats the value stored in cost
as follows:
-
Prefix: Adds the prefix
"Cost: "
before the value. -
Suffix: Appends the suffix
"$"
after the value. - Color: The entire text is displayed in red.
Assuming the value of cost
is 100
, the result would be:
"Cost: 100$" (displayed in red text).
This formatted result is returned as text and appears in the list view or wherever the formatting is applied.
Return Types
The function returns the formatted text based on the specified parameters for prefix, suffix, and color.
Example
format(cost, "Cost: ", "$", "red")
The example call format(cost, "Cost: ", "$", "red")
formats the value stored in cost
as follows:
-
Prefix: Adds the prefix
"Cost: "
before the value. -
Suffix: Appends the suffix
"$"
after the value. - Color: The entire text is displayed in red.
Assuming the value of cost
is 100
, the result would be:
"Cost: 100$" (displayed in red text).
This formatted result is returned as text and appears in the list view or wherever the formatting is applied.
Tips and Notes
- Nesting Formulas: Formulas can be nested within each other to create dynamic and complex calculations.
- Clarity: Use clear and structured formulas to improve readability.
- Testing: Verify functionality by building and testing the formula step by step.
A detailed overview of operators can be found in the article Flavors of Type "Formula" .
Comments
0 comments
Please sign in to leave a comment.