# 内部记录函数

内部记录函数可用于：

* 数据加载脚本（当对当前记录的评估需要一个来自以前加载的数据记录的值时）。
* 图表表达式（当需要来自可视化数据集的其他值时）。

信息注释

当在图表的任何表达式中使用记录间图表函数时，不允许对图表中的 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-CN/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-CN/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-CN/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-CN/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-CN/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-CN/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-CN/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-CN/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() 返回字段值 value 在字段 field\_name 中的位置（按加载顺序）。

[**fieldindex**](https://help.qlik.com/zh-CN/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-CN/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() 是一个整数函数，用于返回字段中相异值的数量。

[**fieldvaluecount**](https://help.qlik.com/zh-CN/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-CN/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-CN/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-CN/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-CN/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-CN/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-CN/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-CN/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() 用于查找已经加载的表格，并返回与在字段 match\_field\_name 中第一次出现的值 match\_field\_value 对应的 field\_name 值。表格可以是当前表格或之前加载的其他表格。

[**LookUp**](https://help.qlik.com/zh-CN/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-CN/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-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/Scripting/InterRecordFunctions/Previous.htm)(expr)

## 了解详情

* [范围函数](https://help.qlik.com/zh-CN/cloud-services/Subsystems/Hub/Content/Sense_Hub/ChartFunctions/RangeFunctions/RangeFunctionsInCharts.htm)