Cvent API: Multiple Searches

Narrowing Down a Search with Cvent API

In the past all of my searches in Cvent have been one search to find what I needed but today I ran into a problem. While doing a search for all users that have taken one of our surveys, the search returned 505 people. The next line does a Retrieve of those records, this is where my problem ended up. Cvent limits you to 200 Retrievals per call, so I either had to breakup the array or get less records.

My current code:

thesearch.Filter = New com.cvent.api.Filter(0) {}
 thesearch.Filter(0) = New com.cvent.api.Filter()

thesearch.Filter(0).Field = "Surveyid"

 thesearch.Filter(0).Value = "c382ea11-8825-4161-8513-########"
 thesearch.Filter(0).Operator = com.cvent.api.CvSearchOperatorType.Equals

ids = _ws.Search(com.cvent.api.CvObjectType.Respondent, thesearch)

There had to be away to do a deeper search, specially with the small retrieval requirements. I figured out that you can add more filters and require it to use AND or OR with them.

And or OR is controlled by:

thesearch.SearchType = com.cvent.api.CvSearchType.AndSearch


thesearch.SearchType = com.cvent.api.CvSearchType.ORSearch

Adding more indepth searches (filters). This searches for the survey but also only those who have finished the survey which so far is only 10

'build array size
 thesearch.Filter = New com.cvent.api.Filter(1) {}
'new for array row 0
 thesearch.Filter(0) = New com.cvent.api.Filter()
'new for array row 1
 thesearch.Filter(1) = New com.cvent.api.Filter()
'type of search between filters
 thesearch.SearchType = com.cvent.api.CvSearchType.AndSearch
 thesearch.Filter(0).Field = "SurveyId"
 thesearch.Filter(0).Value = "c382ea11-8825-4161-8513-b977568b50f8"
 thesearch.Filter(0).Operator = com.cvent.api.CvSearchOperatorType.Equals

 thesearch.Filter(1).Field = "Status"
 thesearch.Filter(1).Value = "Complete Response" 'Real Survey
 thesearch.Filter(1).Operator = com.cvent.api.CvSearchOperatorType.Equals

Luckly, This survey will only have around 100 respondents, but what if at some point I need to import 200+, I guess that will be another blog post.

Technorati Tags: , , , , ,


Leave a Reply