How Do I Create a Formatting Pattern for a Column?
This Lesson describes how to build a format pattern usable in the Data Grid Helper Plugin for formatting numbers.
What Are the Symbols supported by the Pattern?
You can build patterns by using:
spaces Separator replaced by the content of the DGH's thousands separator property.
# Digit placeholder. This code does not display extra zeros.
0 Digit placeholder. This code pads the value with zeros to fill the format.
. Decimal number replaced by the content of the DGH's decimal separator property.
$ - + / ( )
[color] Where color is any color name supported by the LiveCode syntax.
How Can I define Patterns for Positive, Negative or Zero Values?
A Pattern for a column can be separated in three patterns items:
- the first for Positive Numbers
- the second for Negative Numbers
- the last for Zero Values
Note that for having an empty result for Zero Values, you need to input a space in the last pattern item.
The pattern delimiter is the comma.
Could You Present Some Examples of What Can be Done With Patterns?
![Could You Present Some Examples of What Can be Done With Patterns?](https://media.screensteps.com/image_assets/assets/006/772/639/original/Could%20You%20Present%20Some%20Examples%20of%20What%20Can%20be.png)
How to format the numbers of this datagrid to have something more readable?
Here is some examples of usable patterns in DGH:
Positive Pattern: ########
![Positive Pattern: ########](https://media.screensteps.com/image_assets/assets/006/772/641/original/Positive%20Pattern%20--------.png)
Positive Pattern: #######0
![Positive Pattern: #######0](https://media.screensteps.com/image_assets/assets/006/772/643/original/Positive%20Pattern%20-------0.png)
Positive Pattern: #######.##
![Positive Pattern: #######.##](https://media.screensteps.com/image_assets/assets/006/772/645/original/Positive%20Pattern%20-------.png)
Positive Pattern: ######0.00
![Positive Pattern: ######0.00](https://media.screensteps.com/image_assets/assets/006/772/647/original/Positive%20Pattern%20------0.00.png)
Positive,Negative pattern: ######0.00,(######0.00)
![Positive,Negative pattern: ######0.00,(######0.00)](https://media.screensteps.com/image_assets/assets/006/772/649/original/Positive-Negative%20pattern%20------0.00--------0..png)
Positive,Negative pattern: ######0.00,######0.00[red]
![Positive,Negative pattern: ######0.00,######0.00[red]](https://media.screensteps.com/image_assets/assets/006/772/651/original/Positive-Negative%20pattern%20------0.00-------0.0.png)
Positive,Negative pattern: ### ##0.00[blue],-### ##0.00[red] (with thousands separator = , (comma))
![Positive,Negative pattern: ### ##0.00[blue],-### ##0.00[red] (with thousands separator = , (comma))](https://media.screensteps.com/image_assets/assets/006/772/653/original/Positive-Negative%20pattern%20---%20--0.00-blue-----.png)
Positive,Negative,Zero value pattern: $### ##0.00,$### ##0.00[red],$0.00 (with thousands separator = , (comma))
![Positive,Negative,Zero value pattern: $### ##0.00,$### ##0.00[red],$0.00 (with thousands separator = , (comma))](https://media.screensteps.com/image_assets/assets/006/772/655/original/Positive-Negative-Zero%20value%20pattern%20----%20--0..png)
$### ##0.00,$### ##0.00[red], (with thousands separator = , (comma))
![$### ##0.00,$### ##0.00[red], (with thousands separator = , (comma))](https://media.screensteps.com/image_assets/assets/006/772/657/original/----%20--0.00-----%20--0.00-red--%20%20-with%20thousands.png)
Note the last pattern item contains a space.
William Moseid
Excellent!