SDK Reference v2.0.0 / SurveyAnswersQuery
SurveyAnswersQuery
struct SurveyAnswersQuery : PagedQuery
Specifies filtering and page-navigation criteria for survey answers.
All query properties are optional. Set non-nil/non-default values only for the properties you want to use for filtering.
You can filter survey answers by two different types of dates: before/after
and insertedBefore/After
. The former properties use the date the answer was recorded by the participant; the latter ones use the date the answer was submitted to the system. The dates may be appreciably different if the participant started a survey, answered a few questions, and then submitted it much later. There may also be minor variations due to the participant’s device time compared to the server time. Use the insertedAfter
property to search for new answers since a prior query.
defaultLimit
static let defaultLimit: Int
The default and maximum number of results per page.
surveyResultID
let surveyResultID: SurveyResult.ID?
Auto-generated, globally-unique identifier for the survey submission containing the answer.
surveyID
let surveyID: Survey.ID?
Auto-generated, globally-unique identifier for the survey containing the step the answer was provided for.
surveyNames
let surveyNames: Set<String>?
Filter by one or more internal names of the surveys which have the answers.
after
let after: Date?
Search for answers recorded by the participant after a specific date.
before
let before: Date?
Search for answers recorded by the participant before a specific date.
insertedAfter
let insertedAfter: Date?
Search for answers submitted to the system after a specific date.
insertedBefore
let insertedBefore: Date?
Search for answers submitted to the system before a specific date.
stepIdentifiers
let stepIdentifiers: Set<String>?
Filter by one or more identifiers for the survey steps for which answers were submitted. Refers to the step identifier field in the MyDataHelps survey editor.
resultIdentifiers
let resultIdentifiers: Set<String>?
Filter by one or more identifiers for the field on the survey step for which answers were submitted. Relevant for form steps, and refers to their form items’ identifier field.
answers
let answers: Set<String>?
Filter by one or more specific text values the answer contains.
limit
let limit: Int
Maximum number of results per page. Default and maximum value is 100.
pageID
let pageID: SurveyAnswersPage.PageID?
Identifies a specific page of survey answers to fetch. Use nil
to fetch the first page of results. To fetch the page following a given SurveyAnswersPage
use its nextPageID
; the other parameters should be the same as the original SurveyAnswersQuery
.
init(surveyResultID: surveyID: surveyNames: after: before: insertedAfter: insertedBefore: stepIdentifiers: resultIdentifiers: answers: limit: pageID:)
init(surveyResultID: SurveyResult.ID? = nil, surveyID: Survey.ID? = nil, surveyNames: Set<String>? = nil, after: Date? = nil, before: Date? = nil, insertedAfter: Date? = nil, insertedBefore: Date? = nil, stepIdentifiers: Set<String>? = nil, resultIdentifiers: Set<String>? = nil, answers: Set<String>? = nil, limit: Int = defaultLimit, pageID: SurveyAnswersPage.PageID? = nil)
Initializes a new query for a page of survey answers with various filters.
Parameters
surveyResultID
Auto-generated, globally-unique identifier for the survey submission containing the answer.
surveyID
Auto-generated, globally-unique identifier for the survey containing the step the answer was provided for.
surveyNames
Filter by one or more internal names of the surveys which have the answers.
after
Search for answers recorded by the participant after a specific date.
before
Search for answers recorded by the participant before a specific date.
insertedAfter
Search for answers submitted to the system after a specific date.
insertedBefore
Search for answers submitted to the system before a specific date.
stepIdentifiers
Filter by one or more identifiers for the survey steps for which answers were submitted. Refers to the step identifier field in the MyDataHelps survey editor.
resultIdentifiers
Filter by one or more identifiers for the field on the survey step for which answers were submitted. Relevant for form steps, and refers to their form items’ identifier field.
answers
Filter by one or more specific text values the answer contains.
limit
Maximum number of results per page.
pageID
Identifies a specific page of survey answers to fetch.
page(after:)
func page(after page: SurveyAnswersPage) -> SurveyAnswersQuery?
Creates copy of this query for a page of results following the given page, with the same filters as the original query.
Parameters
page
The previous page of results, which should have been produced with this query.