I'm trying to list the results of a LookUpSet only if they are in another string. Initially I used the following to get an array of strings seperated by a semi-colon.
Join(LookUpSet(...),";")
The next stage was to test if the strings were in the main string. I tried nesting the return value inside an IIF statement;
Join(LookUpSet(...,IIF(InStr(Fields!BigText.Value,Fields!Text.Value) > 0, Fields!Text.Value, Nothing),...),";")
I understand this doesn't work because the big string that I am comparing against is in my first dataset and the other is in my second dataset
Next I tried to use InStr on the results of the LookUpSet;
IIF(InStr(Fields!BigText.Value, LookUpSet()) > 0, LookUpSet(), Nothing)
This won't work either so I've tried to create custom code and am nearly there;
Code.CheckSetInString(Fields!BigText.Value, LookUpSet())
The code is below, when debugging I receive "Object reference not set to an instance of an object", but can't see anything that I've failed to declare.
How should I troubleshoot which object isn't declared? The custom code is below for reference.
Function CheckSetInString(ByVal str As String, ByVal setofstrings As Object())
If setofstrings Is Nothing OrElse Not setofstrings.length > 0 Then
Return Nothing
End If
Dim returnedstrings AS [String]()
Dim i As Integer = 0
For Each item As String In setofstrings
If InStr(1, str, item, 1) > 0 Then
returnedstrings(i) = item
i += 1
End If
Next
Return returnedstrings
End Function
Any advice is appreciated, Dan