The LastQuestionAsked variable is important for tracking down issues
with running projects. It lets you find errors in the script,
identify the area of a survey where respondents are dropping out.
However, because it is a text question, you have to download the data
to do any real annalysis.
I've created a script that we can run before launching a survey. It
creates a categorical variable with a response for each questions.
------------------------------------
'This code opens an MDD and then creates a categorical variable
called LastQuestionAsked
'The categories for this question are based on the questionnames in
the survey
'and an expression is created for each category.
Dim MDM, lastQ, myExpression,myQuestion,myElement
Set MDM = CreateObject("MDM.Document")
MDM.Open("C:\TestProjects\mrStudio\mySurvey.mdd")
On Error Goto ErrorHandler
Set lastQ = MDM.CreateVariable("LastQuestionAsked","Last Question
Asked")
With lastQ
.MinValue = 1
.MaxValue = 1
.DataType = 3 'MDM.DataTypeConstants.mtCategorical
For Each myQuestion in MDM.Variables
If myQuestion.UsageType = &H0000 Then 'vtVariable = &H0000
Set myElement = MDM.CreateElement
(myQuestion.name,myQuestion.name)
myElement.Type = &H0000 ' mtCategory =
&H0000
myElement.expression
= "DataCollection.EndQuestion.Find(""" + myQuestion.name+ """)"
.Elements.Add(MyElement)
End If
Next
End With
MDM.Fields.add(lastQ)
MDM.CategoryMap.AutoAssignValues()
MDM.Save("C:\TestProjects\mrStudio\mySurvey.mdd")
ErrorHandler:
MDM.Close()