Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ Engineering

DbFormat

  • Last UpdatedJun 02, 2022
  • 1 minute read

This object allows formatting of DbDouble's as a string having properties to set the dimension, decimal points, label etc. For example, formatting a temperature

t1 = DbDouble.Create("0 celsius");

DbFormat tempFmt = DbFormat.Create();

tempFmt.Dimension = DbDoubleDimension.GetDimension(DbDimension.TEMP);

tempFmt.Units = DbDoubleUnits.GetUnits(DbUnits.CELSIUS);

tempFmt.DecimalPoints = 1;

tempFmt.Label = "degC";

string tempStr = t1.ToString(tempFmt);

or constructing a DbDouble from a string and given format

DbFormat f1 = DbFormat.Create();

f1.Dimension = DbDoubleDimension.GetDimension(DbDimension.DIST);

f1.Units = DbDoubleUnits.GetUnits(DbUnits.INCH);

DbDouble d1 = DbDouble.Create("1", f1);

A DbFormat object has a property that is a pointer to another DbFormat. This format will be used (delegated to) in toString type operations if the value produce by the current DbFormat is less than one.

Delegation can continue along a chain formatting the quantity to ever smaller units. All these format objects must be consistent dimension and progressively smaller units.

Related Links
TitleResults for “How to create a CRG?”Also Available in