🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
MetricImperial
This page was created by Hans.karlsen on 2025-09-03. Last edited by Hans.karlsen on 2025-09-03.

In multi-cultural systems it may be important to handle imperial types on numbers.

In this MDriven-supported approach the value stored is always in the metric system - but you can allow for display and edit in Imperial-system.

The settings are controlled by a model pattern that is part of the SysTranslations merge model that is described here Documentation:Localization - MDrivenWiki.

Documentation MetricImperial 1756881164678.png

The important setting for MetricImperial are:

SysCultureSettingsSingleton.MetricNotImperial:Boolean=true

This you would probably make derived - and let each user store their own value for this setting.

The functionality is used by setting a tagged value on an Attribute of type decimal,float,double,int of MetricImperial with one of the following values:

GramOunce,

MillimeterInch,

MilliliterFluidOunce,

CelsiusFahrenheit,

SquareKilometersSquareMiles,

SquareMetersSquareFeet,

SquareCentimetersSquareInches,

KilometersPerHourMilesPerHour,

MetersPerSecondFeetPerSecond

You may also set the MetricImperialUIDecimals tagged value to an integer to controls how many decimals are used after conversion. The default value if not given is 2*SysCultureSettingsSingleton.DefaultDecimalDisplay (DefaultDecimalDisplay defaults to 2 if not given).

Presentation unit

This functionality hi-jacks the PresentationUnit and sets it and updates it according to the MetricNotImperial setting.

Example:

Label : The temp (°C) will turn into The temp (°F) when MetricNotImperial=false