How to represent value with a unit and value in a currency?

#1

What are the benefits of using Dimension or ExactDimension for value with a unit?

Is there a type for value in a currency?

0 Likes

#2

The difference between Dimension and ExactDimension is that the value field is of type double and decimal, respectively. See the PostgreSQL documentation for more details.

The Currency type is different from the Unit type. While Dimension and ExactDimension have a unit field of type Unit, the MonetaryValue type has a currency field of type Currency (and a value field of type decimal). MonetaryValue should be used for all currency-related values.

0 Likes

#3

Is there a type for value in a currency per unit? For example, the shipping cost is $5 per kg.

0 Likes

#4

There are similar units defined, for example, dollars-per-unit and dollars-per-kwh

c3Grid(Unit.get("dollars-per-unit"))
c3Grid(Unit.get("dollars-per-kwh"))

You could create a new one like dollars-per-kilogram

0 Likes