# 記錄間函數

使用記錄間函數的時機：

* 在資料載入指令碼中，當評估目前記錄需要先前載入的資料記錄時。
* 在圖表運算式中，當需要來自視覺化資料集的其他值時。

資訊備註

當任何圖表運算式使用了記錄間圖表函數時，就不允許在圖表中依據 Y 值排序，或在表格中依據運算式資料行排序。因此，這些排序替代選項會自動停用。若您在視覺化或表格中使用記錄間圖表函數，視覺化的排序將還原為對記錄間函數的排序輸入。此限制不適用於對等指令碼函數 (如有)。

資訊備註自行參考運算式定義只能在少於 100 列的表格中進行，但是這將會隨 Qlik 引擎執行的硬體而異。

使用每個函數中的下拉式功能表，以查看每個函數的簡要描述及語法。按一下語法描述中的函數名稱，以取得進一步詳細資料。

## 列函數

這些函數僅可用於圖表運算式。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Above

Above() 會在表格中某個資料行區段內的目前列上方，在某個列中評估運算式。用來計算的列取決於 offset 的值，如果呈現，預設情況下是正上方的列。對於表格以外的圖表，Above() 會評估圖表連續表同等表格中目前列上方的列。

[**above**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/above.htm)([TOTAL [&lt;fld{,fld}&gt;]] expr [ , offset [,count]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Below

Below() 會在表格中某個資料行區段內的目前列下方，在某個列中評估運算式。用來計算的列取決於 offset 的值，如果呈現，預設情況下是正下方的列。對於表格以外的圖表，Below() 會評估圖表連續表同等表格中目前資料行下方的列。

[**below**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/below.htm)([TOTAL[&lt;fld{,fld}&gt;]] expression [ , offset [,count ]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Bottom

Bottom() 會在表格中某個資料行區段內的最後一 (底端) 列，評估運算式。用來計算的列取決於 offset 的值，如果呈現，預設情況下是底端的列。對於表格以外的圖表，該運算式會評估圖表連續表同等表格中目前資料行的最後一列。

[**bottom**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/bottom.htm)([TOTAL[&lt;fld{,fld}&gt;]] expr [ , offset [,count ]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Top

Top() 會在表格中某個資料行區段內的第一 (頂端) 列，評估運算式。用來計算的列取決於 offset 的值，如果呈現，預設情況下是頂端的列。對於表格以外的圖表，Top() 會評估圖表連續表同等表格中目前資料行的第一列。

[**top**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/top.htm)([TOTAL [&lt;fld{,fld}&gt;]] expr [ , offset [,count ]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### NoOfRows

NoOfRows() 傳回表格中目前資料行區段中的列數。對於點陣圖圖表，NoOfRows() 傳回圖表的連續表同等表格中的列數。

[**noofrows**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/noofrows.htm)([TOTAL])

## 資料行函數

這些函數僅可用於圖表運算式。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Column

Column() 會忽略維度，傳回在對應於連續表中 ColumnNo 的資料行中找到的值。例如，Column(2) 傳回第二個量值資料行的值。

[**column**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/column.htm)(ColumnNo)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Dimensionality

Dimensionality() 傳回目前列的維度數目。如果是樞紐分析表格，則該函數傳回有非彙總內容 (亦即不包含部分加總或摺疊彙總) 之維度資料行的總數目。

[**dimensionality**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/dimensionality.htm) ( )

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Secondarydimensionality

SecondaryDimensionality() 傳回有非彙總內容 (亦即不包含部分加總或摺疊彙總) 之維度樞紐分析表列的數目。此函數相當於針對水平樞紐分析表維度的 dimensionality() 函數。

[**secondarydimensionality**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/secondarydimensionality.htm) ( )

## 欄位函數

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### FieldIndex

FieldIndex() 傳回在欄位 field\_name 中欄位值 value 的位置 (依據載入順序)。

[**fieldindex**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/fieldindex.htm)(field\_name , value)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### FieldValue

FieldValue() 傳回在欄位 field\_name 的位置 elem\_no 找到的值 (依據載入順序)。

[**fieldvalue**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/fieldvalue.htm)(field\_name , elem\_no)

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### FieldValueCount

FieldValueCount() 是一個 integer 函數，傳回欄位中相異值的數目。

[**fieldvaluecount**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/fieldvaluecount.htm)(field\_name)

## 樞紐分析表函數

這些函數僅可用於圖表運算式。

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### After

After() 傳回以樞紐分析表的維度值評估而得的運算式值，這些值會顯示在樞紐分析表的列區段內，目前資料行之後的資料行中。

[**after**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/after.htm)([TOTAL] expression [ , offset [,n]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Before

Before() 傳回以樞紐分析表的維度值評估而得的運算式值，這些值會顯示在樞紐分析表的列區段內，目前資料行之前的資料行中。

[**before**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/before.htm)([TOTAL] expression [ , offset [,n]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### First

First() 傳回以樞紐分析表的維度值評估而得的運算式值，這些值會顯示在樞紐分析表中目前列區段的第一個資料行中。此函數在所有圖表類型中都會傳回 NULL，除了樞紐分析表以外。

[**first**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/first.htm)([TOTAL] expression [ , offset [,n]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Last

Last() 傳回以樞紐分析表的維度值評估而得的運算式值，這些值會顯示在樞紐分析表中目前列區段的最後一個資料行中。此函數在所有圖表類型中都會傳回 NULL，除了樞紐分析表以外。

[**last**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/last.htm)([TOTAL] expression [ , offset [,n]])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### ColumnNo

ColumnNo() 傳回樞紐分析表中目前列區段內，目前資料行的編號。第一行的編號為 1。

[**columnno**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/columnno.htm)([TOTAL])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### NoOfColumns

NoOfColumns() 傳回樞紐分析表中目前列區段中的資料行數。

[**noofcolumns**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/noofcolumns.htm)([TOTAL])

## 資料載入指令碼中的記錄間函數

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Exists

Exists() 會判定特定欄位值是否已載入資料載入指令碼的欄位中。該函數會傳回 TRUE 或 FALSE﹐因此可以在 LOAD 陳述式或 IF 陳述式的 where 子句中使用。

[**Exists**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecordFunctions/Exists.htm)(field\_name [, expr])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### LookUp

LookUp() 會查看已載入的表格，並且傳回的 field\_name 值相當於欄位 match\_field\_name 中出現的第一個值 match\_field\_value。該表格可以是目前表格，或者先前載入的另一個表格。

[**LookUp**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecordFunctions/LookUp.htm)(field\_name, match\_field\_name, match\_field\_value [, table\_name])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Peek

Peek() 會傳回表格中已載入的列的欄位值。可以指定列號，也可以指定表格。若未指定列數，將會使用上一個載入的記錄。

[**Peek**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecordFunctions/Peek.htm)(field\_name[, row\_no[, table\_name ] ])

[](https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/InterRecordFunctions/inter-record-functions-charts.htm)

#### Previous

Previous() 會使用由於 where 子句而尚未捨棄的先前輸入記錄中的資料，來尋找 expr 運算式的值。在內部表格的第一筆記錄中，此函數會傳回 NULL。

[**Previous**](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecordFunctions/Previous.htm)(expr)

## 瞭解更多資訊

* [範圍函數](https://help.qlik.com/zh-TW/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/RangeFunctions/RangeFunctionsInCharts.htm)