ssrs expression to split string possible?

2019-01-26 14:21发布

so in my query i have select columnx from tblz

it returns 001.255556.84546

I want to be able to split this via '.' and put it into three columns.

column1 = 001
column2 = 255556
column3 = 84576

is this possible?

4条回答
在下西门庆
2楼-- · 2019-01-26 14:41

In SSRS you reference the field name, tell it the delimiter to use. Since you are not assigning to a variable, per se, you then need to tell it which part of the split string to use. In your example

=Split(Fields!returnedValue.Value,".")(0)
=Split(Fields!returnedValue.Value,".")(1)
=Split(Fields!returnedValue.Value,".")(2)

You would replace returnedValue with whatever the actual field name is, and place each one of those into your columns 1 - 3, respectively.

查看更多
对你真心纯属浪费
3楼-- · 2019-01-26 14:43

This answer was originally posted in the question instead of being posted as an answer:

=(Split(Fields!columnx.Value,".")).GetValue(0)
=(Split(Fields!columnx.Value,".")).GetValue(1)
=(Split(Fields!columnx.Value,".")).GetValue(2)
查看更多
时光不老,我们不散
4楼-- · 2019-01-26 14:47

Create three calculated fields with the following expressions:

=(Split(Fields!columnx.Value, ".")).GetValue(0)
=(Split(Fields!columnx.Value, ".")).GetValue(1)
=(Split(Fields!columnx.Value, ".")).GetValue(2)

I'm not sure it works or not, maybe give it a try. You might need to use IIF() statement to check values before getting them.

查看更多
啃猪蹄的小仙女
5楼-- · 2019-01-26 14:51

For info, in 2008 these dont work, you have to do the following:

=Split(Fields!returnedValue.Value, ".").GetValue(0)
查看更多
登录 后发表回答