How to map with Format: Number

Introduction

The Format: Number Mapper allows you to change the data type string to a number. Usually used to denote value, for example, prices.

This guide will provide a sample of how you can use this mapper.

Usage

  1. Create a new Value mapper.
  2. Configure the accessor to access the attribute to the value that you want to map.
  3. Add a new mapper and choose Format: Number.
  4. Here you will get some fields to fill in.

  • Decimals. The number of decimal digits. If 0, the decimal point is omitted from the return value.
  • Decimal Point. The separator for the decimal point.
  • Thousand Separator. The thousands separator. However, it’s possible to use this mapper without the thousand separator as it’s optional now.

Example

For example, you have the below data in an entity, and you need to format the number of the “price” property from 1299 to 1,299.00.

{
  "sku": "SKU001",
  "name": "T-Shirt 001",
  "price": 1299
}

JavaScript

You can use this transformer to format it to the mentioned format.

How can I adjust the number of digits in a given number to meet a specific format?

Example

Lets reproduce 9 in 9 digits

expected solution: 000000009

Hi Abubakar,

It can be achieved by using String: Prepend and then using String: Cut.
Please see below for an example:

2 Likes