Search code examples
vb.netsmartsheet-api

Faster way to query a smartsheet?


So I am looking for a faster way to query something in a smartsheet. The API is very helpful, but the search function is very limited.

As of now, it works, but it is very very slow. The longer the list, the longer it takes to populate the list.

Whenever a cad user changes the combobox to their name, I search the sheet based on their name in the cbUsers.Text

Private Sub cbUsers_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbUsers.SelectedIndexChanged
        If listJobQue.Items.Count > 0 Then
            listJobQue.Items.Clear()
        End If

        Dim ss As New SmartSheetIntegration()
        Dim result As SearchResult
        result = ss.SearchQue(1737025469605764, cbUsers.Text)

        For Each searchResult As SearchResultItem In result.Results
            If searchResult.ObjectType = SearchObjectType.ROW Then
                Dim rowID As Long
                rowID = searchResult.ObjectId
                rowIDs.Add(rowID) 'this stores the IDs for later use when they click on an item in the list box.
                Dim row As Row = ss.GetRow(3083654818752388, "LIVE RFD INPUT", rowID)
                listJobQue.Items.Add(row.Cells(6).Value)
            End If
        Next

    End Sub

The SearchQue() is here

Public Function SearchQue(sheetID As Int64, name As String)

        Return smartSheet.SearchResources.SearchSheet(sheetID, name)

    End Function

Does anyone know of a faster and more efficient way of doing this?

Thanks!


Solution

  • This is the fastest way.

    Problem was integrating this with a Rhino3D vb.net plugin. That was the cause of the poor performance.

    Wrote a test desktop app in c#, brought in 600 rows without a hiccup.