Average

Average

Logic name

Average (Document Mapper)

Function

This logic returns the average value of the input nodes.

Data types

Location

Type

First input handler

Node set

Logic output

Numeric

= Hint =

For details, refer to Logic specifications.

Properties

Category

Property

Description

Precision

Specify precision

Select whether to directly specify the decimal places of precision in decimal type calculation.

Precision

Specified digits

Directly specify the number of decimal places in decimal type precision.

Precision

Rounding

Specify the method of rounding.

Comment

Comment

You can write a description of the logic. It doesn't affect the conversion process.

Notes

  • For logics in the "Collect" category (hereinafter: Collective logic), result data that meet the following conditions are output:

    1. The input source of the first input handler is below the loop point.

    2. The output target of the Collective logic is above the loop point.

    Therefore, the result data of the Collective logic can't be output if the output schema is of table model type because the output target can't be set above the loop point.

    = Hint =

    In case of outputting the aggregation result to a table model type component, first aggregate data using XML type output schema, and then output the result to the table model type component using Mapper.

  • The value of single input node will be output if output schema is not set to loop mapping.

Logic sample

Mapping definition

Logic settings and processing result

The logic calculates the average population of each municipality by state.

Property settings

Property

Setting

Specify precision

Selected

Specified digits

3

Rounding

Round to 0.

Input data

Los Angeles,California,3822238

San Francisco,California,808437

Sacramento,California,528001

San Diego,California,1381162

San Jose,California,971233

Fresno,California,545567

Cambridge,Massachusetts,118488

Boston,Massachusetts,650706

Springfield,Massachusetts,154064

Lowell,Massachusetts,113608

Worcester,Massachusetts,205319

Output data

  • xml_write

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>

    <Census>

      <State Name="California" Stateaverage="1342773.000">

        <City Population="3822238" Name="Los Angeles"/>

        <City Population="808437" Name="San Francisco"/>

        <City Population="528001" Name="Sacramento"/>

        <City Population="1381162" Name="San Diego"/>

        <City Population="971233" Name="San Jose"/>

        <City Population="545567" Name="Fresno"/>

      </State>

      <State Name="Massachusetts" Stateaverage="248437.000">

        <City Population="118488" Name="Cambridge"/>

        <City Population="650706" Name="Boston"/>

        <City Population="154064" Name="Springfield"/>

        <City Population="113608" Name="Lowell"/>

        <City Population="205319" Name="Worcester"/>

      </State>

    </Census>

  • Script variables

    average of population= 845347.545

 

= Hint =

For a list of logics, refer to Mapper Logic Guide.