Sunday 22 March 2015

Autonumber with AutoID

autonumber(expression[ , AutoID])
Returns a unique integer value for each distinct evaluated value of expression encountered during the script execution. This function can be used e.g. for creating a compact memory representation of a complex key.

In order to create multiple counter instances if the autonumber function is used on different keys within the script, an optional parameter AutoID can be used for naming each counter. 

Run the script:
TestAutoNumber:
Load * Inline [
Field1, Field2, Field3, Field4
1, 2, 3, 4
5, 6, 7, 8
9, 10, 11, 12
];

Table1:
LOAD
        *,
        AutoNumber(Field1, 'counter1') as a,
        AutoNumber(Field2, 'counter1') as b,
        AutoNumber(Field3, 'counter2') as c
Resident
        TestAutoNumber;

DROP Table TestAutoNumber;

Add table box:

Following  animation demostrates how counter1 and counter2 had been created

Copyright © 2015 Ruslan Goncharov

2 comments:

  1. As we know there are many companies which are converting into Big data implementation services with the right direction we can definitely predict the future.

    ReplyDelete