LiveCode LessonsHow to - LiveCode Marketplace Products Data Grid HelperHow Do I Create a Formatting Pattern for a Column?

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?

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: ########

Positive Pattern: #######0

Positive Pattern: #######0

Positive Pattern: #######.##

Positive Pattern: #######.##

Positive Pattern: ######0.00

Positive Pattern: ######0.00

Positive,Negative pattern: ######0.00,(######0.00)

Positive,Negative pattern: ######0.00,(######0.00)

Positive,Negative pattern: ######0.00,######0.00[red]

Positive,Negative pattern: ######0.00,######0.00[red]

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))

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))

$### ##0.00,$### ##0.00[red],  (with thousands separator = , (comma))

$### ##0.00,$### ##0.00[red],  (with thousands separator = , (comma))

Note the last pattern item contains a space.

1 Comments

William Moseid

Excellent!

Add your comment

E-Mail me when someone replies to this comment