开发者

ssrs expression to split string possible?

开发者 https://www.devze.com 2023-03-25 11:23 出处:网络
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 t开发者_StackOverflowhree columns.

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 t开发者_StackOverflowhree columns.

column1 = 001
column2 = 255556
column3 = 84576

is this possible?


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

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


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.


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.


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)
0

精彩评论

暂无评论...
验证码 换一张
取 消