ssrs 中的子字符串值仅获取月份编号

Substring value in ssrs to get only month number

当我是 运行 ssrs 时,我的字段月份有问题,因为值为:

[Dim_Tiempo_].[Mes].&[6]

所以我尝试对字符串进行子串处理以仅获取值 6:

=CINT(Left(Right(Parameters!DimTiempoMes.Value(0),3),2))

但我只是得到#Error 没有说明为什么。有人可以帮我吗?

当你向右走最后 3 个字符时,你得到 [6],然后你向左走 2,你得到 [6.. 将其转换为 int 显然会 return 和错误.如果你没有放置 CINT.. 你就会看到发生了什么.. 你需要的是以下内容

  =cint(replace(left(Split(Parameters!DimTiempoMes.Value(0),"[").GetValue(3),2),"]",""))