Hi there,
I have a simple SDK script that searches for documents, gets its field values then writes them in a .csv file, like so:
Try
Dim dPath As String = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Dim csvWriter As New System.IO.StreamWriter(dPath & "\temp.csv")
Dim headerRow As String
Dim dataRow As String
Dim csvData As New StringBuilder
headerRow = "Field Value 1,Field Value 2"
csvData.AppendLine(headerRow)
Dim Search As LFSearch = me.Database.CreateSearch()
Search.Command = "{search syntax}"
Search.BeginSearch(True)
Dim SearchHits As ILFCollection = Search.GetSearchHits()
If SearchHits.Count > 0 Then
For Each Hit As LFSearchHit In SearchHits
Dim Doc As LFDocument = Hit.Entry
Dim Fd As LFFieldData = Doc.fielddata
Dim Fieldval1 As String = Fd.Field("Field 1")
Dim Fieldval2 As String = Fd.Field("Field 2")
dataRow = Fieldval1 & "," & Fieldval2
csvData.AppendLine(dataRow)
Next
Else
dataRow = "No records to display"
csvData.AppendLine(dataRow)
End If
csvWriter.Write(csvData)
csvWriter.Close
csvWriter = Nothing
csvData = Nothing
Search.Dispose()
Catch Ex As Exception
End Try
What I want to do now, is remove the search syntax from the script, and instead use a (Workflow) Search activity to search for the documents, then using a For Each Entry activity, put the search results in a multi-value token, then use the multi-value token in the script (instead of the hits from the now removed search syntax).
If this is possible, any example on how to do it will be very much appreciated. Thank you.