0

I used the suggested below custom SSRS code by user:20977 to create a function that would split a string and return the splitted value or "".

This all worked just fine, but suddenly stopped working and I cannot for the heck of it understand why?

Public Function ExtractCode(Combined As String, Position As Integer) As String <br>
    if (Split(Combined," - ").Length >=Position) Then <br>
    Return Split(Combined," - ").GetValue(Position-1) <br>
          Else <br>
    Return "" <br>
    End If <br>
End Function 

this code is called from the report with:

=Code.ExtractCode(Fields!FreightForwarder_c.Value, 1) 
=Code.ExtractCode(Fields!FreightForwarder_c.Value, 2)etc..

What could have gone wrong here?

thanks in advance for any suggestions.

M A
  • 71,713
  • 13
  • 134
  • 174
  • 1
    Not working means what exactly happens ? Any errors/Exceptions ? – Mahesh Jan 08 '15 at 06:55
  • Sorry, field came out empty - but found out that the query had been altered, which is why the textboxes stopped populating. Would have expected some error message but none was shown :-( – Niklas Bahne Jan 14 '15 at 14:57

2 Answers2

0

This looks like a very straight foreward function and in my tests it worked like it should.

Go thru your data and check if you do not pass strange values as parameter.

Check your report server log file to be sure if there are no messages there.

Jacob Siemaszko
  • 346
  • 1
  • 5
  • 20
0

thanks for your reply - went through every piece of it and it turned out that an older version of the query had been copied in by mistake and I didn't come to check that becuase I knew I had included the field. Strange thing however that the enginge didn't give any warnings that the added field wasn't populated through the query!?