auto-number

www.altova.com Print this Topic Previous Page Up One Level Next page

Home >  Functions > Function Library Reference > core | generator functions >

auto-number

The auto-number function generates integers in target nodes of a component, depending on the various parameters you define. The function result is a value starting at start_with and increased by increment. Default values are: start-with=1 and increase=1. Both parameters can be negative.

fn-autonr

Make sure that the result connector (of the auto-number function) is directly connected to a target node. The exact order in which functions are called by the generated mapping code is undefined. MapForce may choose to cache calculated results for reuse, or evaluate expressions in any order. It is therefore strongly recommended to take care when using the auto-number function.

 

global-id

This parameter allows you to synchronize the number sequence output of two separate auto-number functions connected to a single target component.

 

If the two auto-number functions do not have the same global-id, then each increments the target items separately. In the example below, each function has a different global-id i.e. a and b.

 

The output of the mapping is 1,1,2,2. The top function supplies the first 1 and the lower one the second 1.

fn-autonr1

If both functions have identical global-ids, a in this case, then each function "knows" about the current auto-number state (or actual value) of the other, and both numbers are then synchronised/in sequence.

 

The output of the mapping is therefore 1, 2, 3, 4.The top function supplies the first 1 and the lower one now supplies a 2.

fn-autonr2

 

start-with

The initial value used to start the auto numbering sequence. Default is 1.

 

increment

The increment you want auto-number sequence to increase by. Default is 1.

 

restart on change

Resets the auto-number counter to "start-with", when the content of the connected item changes.

 

In the example below, start-with and increment are both using the default 1. As soon as the content of Department changes, i.e. the department name changes, the counter is reset and starts at 1 for each new department.

fn-auto-chng


© 2019 Altova GmbH