Difference between revisions of "Extensions.Quantities.CreateQuantity"
Jump to navigation
Jump to search
m (Hb moved page CreateQuantity to Extensions.Quantities.CreateQuantity: #3153) |
|||
(8 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
− | [[Category:Quantities]] | + | {{DISPLAYTITLE:'''CreateQuantity '''}}[[Category:Quantities]] |
== Classification == | == Classification == | ||
− | {{ClassificationActivity | CreateQuantity | Constructor for a '''Quantity''' | [[Term]] | [[Quantities|OTX Quantities extension]] | [[Quantity and Unit related terms]] | [[InvalidConversionException]] | - }} | + | {{ClassificationActivity | CreateQuantity | Constructor for a '''Quantity''' | [[Term]] | [[Extensions.Quantities|OTX Quantities extension]] | [[Extensions.Quantities#Terms|Quantity and Unit related terms]] | [[Extensions.Quantities.InvalidConversionException|InvalidConversionException]] | - }} |
== OTL Syntax == | == OTL Syntax == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | QuantityTerm | + | QuantityTerm Quantities.CreateQuantity(NumericTerm numeral, UnitTerm displayUnit, NumericTerm displayPrecision); |
</syntaxhighlight> | </syntaxhighlight> | ||
== Description == | == Description == | ||
− | The '''CreateQuantity''' term is the constructor for a '''Quantity'''. It provides a reference to a definition of the unit that is associated with the Quantity. The reference of the unit refers to the SHORT-NAME of an unit UNIT-SPEC document definition within an ODX. | + | The '''CreateQuantity''' term is the constructor for a '''Quantity'''. It provides a reference to a definition of the unit that is associated with the '''Quantity'''. The reference of the unit refers to the SHORT-NAME of an unit UNIT-SPEC document definition within an ODX. |
− | {{TermReturnValue| [[Quantity]] | Created Quantity.}} | + | {{TermReturnValue| [[Extensions.Quantities.Quantity|Quantity]] | Created Quantity.}} |
== Properties == | == Properties == | ||
{| {{TableHeader}} | {| {{TableHeader}} | ||
{{TableRowPropertiesHeader}} | {{TableRowPropertiesHeader}} | ||
− | {{ | + | {{TableRowPropertie2| Numeral | [[Numeric]] | [[Term]] | - | [1] | Represents the numeric value from which the '''Quantity''' will be created (in display units). The value can be either an '''Integer''', a '''Float''' or another '''Quantity'''.}} |
− | {{ | + | {{TableRowPropertie1| DisplayUnit |[[Extensions.Quantities.Unit|Unit]]| [[Term]] | - | [1] | Represents the display unit of the to-be-created '''Quantity'''.}} |
+ | {{TableRowPropertie2| DisplayPrecision | [[Numeric]]| [[Term]] | - | [0..1] | Optionally represents the display precision of the to-be-created '''Quantity'''. Float values will be truncated.}} | ||
|} | |} | ||
== OTL Examples == | == OTL Examples == | ||
<syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | <syntaxhighlight lang="java" enclose="div" style="font-size: medium;"> | ||
− | + | /// Local Declarations | |
− | + | Quantities.Quantity Quantity; | |
+ | |||
+ | /// Flow | ||
+ | |||
+ | Quantity = Quantities.CreateQuantity(12.44, [@Unit, "BL_DataLibraMIB.odx", "km/h"], 0); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== See also == | == See also == | ||
− | [[GetDisplayValue]] <br/> | + | [[Extensions.Quantities.GetDisplayValue|GetDisplayValue]] <br/> |
− | [[GetDisplayUnit]] <br/> | + | [[Extensions.Quantities.GetDisplayUnit|GetDisplayUnit]] <br/> |
− | [[GetBaseUnit]] | + | [[Extensions.Quantities.GetBaseUnit|GetBaseUnit]] |
Latest revision as of 03:11, 13 September 2019
Contents
Classification
Name | CreateQuantity |
Short Description | Constructor for a Quantity |
Class | Term |
Extension | OTX Quantities extension |
Group | Quantity and Unit related terms |
Exceptions | InvalidConversionException |
Checker Rules | - |
Standard Compliant | Yes |
OTL Syntax
QuantityTerm Quantities.CreateQuantity(NumericTerm numeral, UnitTerm displayUnit, NumericTerm displayPrecision);
Description
The CreateQuantity term is the constructor for a Quantity. It provides a reference to a definition of the unit that is associated with the Quantity. The reference of the unit refers to the SHORT-NAME of an unit UNIT-SPEC document definition within an ODX.
Return Value
The Term returns the value, see table below.
![]()
In OTX, Terms are categorized according to its return data type!
Data Type | Description |
Quantity | Created Quantity. |
Properties
Name | Data Type | Class | Default | Cardinality | Description |
Numeral | Numeric | Term | - | [1] | Represents the numeric value from which the Quantity will be created (in display units). The value can be either an Integer, a Float or another Quantity. |
DisplayUnit | Unit | Term | - | [1] | Represents the display unit of the to-be-created Quantity. |
DisplayPrecision | Numeric | Term | - | [0..1] | Optionally represents the display precision of the to-be-created Quantity. Float values will be truncated. |
OTL Examples
/// Local Declarations
Quantities.Quantity Quantity;
/// Flow
Quantity = Quantities.CreateQuantity(12.44, [@Unit, "BL_DataLibraMIB.odx", "km/h"], 0);