MTRound

Program ID

MetraPipeline.MTRoundPlugin.1

Description

The MTRound plugin rounds a list of values to the required precision. It iterates through all of the Value properties in the <Rounding> set.

The Rounding plug-in only affects the fractional value. It doesn't round 0.5 to 1. If you attempted to round 0.5 with a precision of 1 the result is 0.5. Roudning 0.55 with a precision of 1 yields a value of 0.6. Also, 0.54 rounds to 0.5.

Required Input Properties

Tag name

Value type

Description

Value

decimal

A decimal value to round.

Precision

integer

How many digits of precision to keep.  If you need to remove the fractional value and round to a whole value, set the Precision value to 0.

Required Output Properties

Tag name

Value type

Description

Value

decimal

The rounded value

Additional Configuration Tags

None.

Configuration Example

The following sample configuration information rounds the output of the Taxation plug-in. For example, if the value of _FedTax is 3.4586323, the rounded value is 3.49.

 <configdata>

<configdata>
  <Rounding>

    <Value>_FedTax</Value>

    <Precision ptype="INTEGER">2</Precision>

    <Value>_StateTax</Value>

    <Precision ptype="INTEGER">2</Precision>

    <Value>_CountyTax</Value>

    <Precision ptype="INTEGER">2</Precision>

    <Value>_LocalTax</Value>

    <Precision ptype="INTEGER">2</Precision>

    <Value>_OtherTax</Value>

    <Precision ptype="INTEGER">2</Precision>

  </Rounding>

</configdata>

Remarks

The MTRoundPlugin plugin was created to only round decimal values. Due to the imprecise nature of the decimal data type precision may be lost.  Future versions of the MetraTech platform will support more precise data types and may have different rounding requirements.