ssrs expression to split string possible?

后端 未结 4 549
天涯浪人
天涯浪人 2020-12-18 01:39

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 int

相关标签:
4条回答
  • 2020-12-18 02:05

    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 讨论(0)
  • 2020-12-18 02:07

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

    =Split(Fields!returnedValue.Value, ".").GetValue(0)
    
    0 讨论(0)
  • 2020-12-18 02:13

    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.

    0 讨论(0)
  • 2020-12-18 02:13

    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.

    0 讨论(0)
提交回复
热议问题