autonumber - 指令碼函數
                此指令碼函數會針對在指令碼執行期間出現的每個相異的 expression 評估值,傳回唯一的整數值。此函數可用於如建立複雜金鑰的簡潔記憶表示法。
資訊備註您只能連接已在相同資料載入中產生的 autonumber 索引鍵,因為根據表格的讀取順序產生了整數。如果您需要在資料載入之間使用持續存在的索引鍵,無論來源資料排序為何,您應該使用 hash128、hash160 或 hash256 函數。
                語法:
autonumber(expression[ , AutoID])
引數:
| 引數 | 描述 | 
|---|---|
| AutoID | 
                                 如果 autonumber 函數在指令碼內用於不同的索引鍵,為了建立多個計數器執行個體,可使用選用參數 AutoID 來命名各個計數器。  | 
                        
範例: 建立複合索引鍵
在此範例中,我們使用 autonumber 函數建立複合索引鍵以節省開支。該範例僅供示範之用,在處理含大量列的表格時具有意義。
| Region | Year | Month | Sales | 
|---|---|---|---|
| North | 2014 | May | 245 | 
| North | 2014 | May | 347 | 
| North | 2014 | June | 127 | 
| South | 2014 | June | 645 | 
| South | 2013 | May | 367 | 
| South | 2013 | May | 221 | 
使用內嵌資料載入來源資料。然後,我們新增一個前置載入,從 Region、Year 和 Month 欄位中建立複合索引鍵。
RegionSales: LOAD *, AutoNumber(Region&Year&Month) as RYMkey;  LOAD * INLINE [ Region, Year, Month, Sales North,	2014,	May,	245 North,	2014,	May,	347 North,	2014,	June,	127 South,	2014,	June,	645 South,	2013,	May, 367 South,	2013,	May,	221 ];
                
產生的表格如下所示:
| Region | Year | Month | Sales | RYMkey | 
|---|---|---|---|---|
| North | 2014 | May | 245 | 1 | 
| North | 2014 | May | 347 | 1 | 
| North | 2014 | June | 127 | 2 | 
| South | 2014 | June | 645 | 3 | 
| South | 2013 | May | 367 | 4 | 
| South | 2013 | May | 221 | 4 | 
在此範例中,如果您需要連結至另一個表格,則可以參照 RYMkey (對於範例 1),替代字串 'North2014May'。
現在,我們使用類似的方法載入成本來源表格。在前置載入中排除 Region、Year 和 Month 欄位,以避免建立合成鍵,我們已使用 autonumber 函數建立複合索引鍵,進而連結表格。
RegionCosts: LOAD Costs, AutoNumber(Region&Year&Month) as RYMkey;  LOAD * INLINE [ Region, Year, Month, Costs South,	2013,	May,	167 North,	2014,	May,	56 North,	2014,	June,	199 South,	2014,	June,	64 South,	2013,	May, 172 South,	2013,	May,	126 ];
                
現在,我們可以將表格圖表新增至工作表,并新增 Region、Year 和 Month 欄位,以及銷售額和成本的 Sum 量值。該表格將如下所示:
| Region | Year | Month | Sum([Sales]) | Sum([Costs]) | 
|---|---|---|---|---|
| Totals | - | - | 1952 | 784 | 
| North | 2014 | June | 127 | 199 | 
| North | 2014 | May | 592 | 56 | 
| South | 2014 | June | 645 | 64 | 
| South | 2013 | May | 588 | 465 |