🚀 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-10-13.

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.

2025-10-13 13h33 35.png

The important setting for MetricImperial are:

SysCultureSettingsSingleton.MetricNotImperial_Area:Boolean=true
SysCultureSettingsSingleton.MetricNotImperial_Length:Boolean=true
SysCultureSettingsSingleton.MetricNotImperial_Temperature:Boolean=true
SysCultureSettingsSingleton.MetricNotImperial_Velocity:Boolean=true
SysCultureSettingsSingleton.MetricNotImperial_Volume:Boolean=true
SysCultureSettingsSingleton.MetricNotImperial_Weight: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 (Weight),

MillimeterInch (Length),

MilliliterFluidOunce (Volume),

CelsiusFahrenheit (Temperature),

SquareKilometersSquareMiles (Area),

SquareMetersSquareFeet (Area),

SquareCentimetersSquareInches (Area),

KilometersPerHourMilesPerHour (Velocity),

MetersPerSecondFeetPerSecond (Velocity)

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_Temperature=false