SSRS CByte 函数

SSRS CByte 函数是一个转换函数,可将给定的字段或表达式转换为 Byte。转换为 Byte 类型的 CByte 函数的语法如下所示。

=CByte(Fields!CarsOwned.Value)

为了演示 Reporting Services 中的 CByte 函数,我们使用下面的 Employee 表,该表有 20 条记录。图像显示了 Table 报表中的记录。

Source Table

SSRS CByte 函数示例

为此,我将在 NumberCarsOwned 列的右侧添加一个新列。接下来,右键单击 CByte 下方的文本框,然后选择 Expression 以打开下面显示的表达式窗口。下面的 CByte 表达式会将 Number of Cars Owned 列的 small int 列值转换为 Byte。

  1. 更多函数
  2. 图表
  3. 表格
  4. 格式化表
  5. SSRS
=CByte(Fields!NumberCarsOwned.Value)
SSRS CByte Function expression to convert to Byte

同样,我将创建一个新列将 TotalChildren 值转换为 Byte。执行相同操作的 CByte 函数表达式如下所示。

=CByte(Fields!TotalChildren.Value)

请点击预览选项卡查看报表。

CByte Function to convert expression to Byte report preview