integer

The integer function is used to force an integer value in a JSON document. By default, all user mapped values are stored as text.

Syntax

c4i:integer(integerLike)

Parameters

integerLike

Something that can be converted to an integer. It can be :

  • A number. e.g. : 12
  • A string. e.g. : "12"
  • A boolean. True converts to 1 and false converts to 0

Other types will provoke an IllegalArgumentException

Return value

The evaluated argument as an integer

Example

Given the following STEP XML :

<STEP-ProductInformation>
    <Products>
        <Product ID="PRD1">
            <Values>
                <Value AttributeID="StockQuantity">10</Value>
            </Values>
        </Product>
    </Products>
</STEP-ProductInformation>

The following YAML configuration will produce the following output :

c4i:integer(Values/Value[@AttributeID="StockQuantity"]/text()): stockQuantity
stockQuantity: 10
Last Updated: