LookupSet - Remove Duplicates

1. In design view, right-click outside of the report and open Report Properties dialog box. 2. Click Code in left mode, copy the following code to the text box, then click OK. Public Shared Function RemoveDuplicates(ByVal items As Object()) As String() System.Array.Sort(items) Dim k As Integer = 0 For i As Integer = 0 To items.Length - 1 If i > 0 AndAlso items(i).Equals(items(i - 1)) Then Continue For End If items(k) = items(i) k += 1 Next Dim unique As[String]() = New[String](k - 1) {} System.Array.Copy(items, 0, unique, 0, k) Return unique End Function 3. Right click the text box you used expression and modify the expression like below: =Join(Code.RemoveDuplicates(LookupSet(Fields!itemId.Value & Fields!UseByDate.Value & Fields!rackId.Value, Fields!itemId.Value & Fields!UseByDate.Value & Fields!rackId.Value, Fields!CustomerSeqNo.Value, "PickingList")), ",")

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.