Quota transformation (Quota XML)
Quota data is similar to sample data in that it is represented as a Microsoft .Net DataSet XML serialization when downloaded. The MobileSyncWebService transforms the DataSet XML to a simple Quota XML format, and expects quota updates in the same Quota XML format.
Quota XML is returned from the /Projects/PROJECT/Quota URL to specify the quota expressions and targets. It is POSTed as part of the RespondentData XML to pass back complete and pend counts.
In UNICOM Intelligence, quotas are managed in the sample management or interview scripts. The sample management script is not available to the mobile application. In the interview script, quotas are managed in script blocks, which are also not available to the mobile application. Clients who want to support quotas must create hardcoded rules for when quotas must be pended. For example:
▪A quota that references a sample field is pended before the survey starts, and the survey is not started when the cell is full.
▪A quota that references an interview question is pended after the question is asked, and the survey is ended when the quota is full
▪A quota that references multiple fields is pended, based on the previous rules, at the last instantiation of the rule.
▪All quotas are completed when the survey completes.
▪All quotas are rolled back when the survey is paused.
Because Quota matrices can be very large, the total number of quota cells should be kept below 7,500, and the per matrix total below 1,000. For example, checking the number of cells after every Ask() might negatively impact the application's page to page performance. A useful practice is to create a list of all survey questions and note from which quota cells they are referenced. The practice ensures that only the listed cells are checked after the question is asked. The list can be created when the survey is downloaded, or when the case is started.
Example XML from /Projects/PROJECT/Quota
<Quota>
<QuotaCell QuotaID="1" Name="Top.(0.Region).(0.R1)" MatrixName="Region" Target="20" PreviousCompleteCount="0">
<Expression>
<Text>Region.HasAnswer({R1})</Text>
<Opcodes>…</Opcodes>
</Expression>
</QuotaCell> <QuotaCell QuotaID="2" Name="Top.(0.Region).(0.R2)" MatrixName="Region" Target="20" PreviousCompleteCount="0">
<Expression>
<Text>Region.HasAnswer({R2})</Text>
<Opcodes>…</Opcodes>
</Expression>
</QuotaCell>
</Quota>
Example XML from /Projects/PROJECT/RespondentData (sent as part of RespondentData XML)
<Quota>
<QuotaCell QuotaID="1" Name="Top.(0.Region).(0.R1)" MatrixName="Region" PendCount="0" CompleteCount="5" PreviousCompleteCount="0" RollbackCount="1">
</QuotaCell
<QuotaCell QuotaID="2" Name="Top.(0.Region).(0.R2)" MatrixName="Region" PendCount="0" CompleteCount="7" R PreviousCompleteCount="0" ollbackCount="2">
<QuotaHistory RespondentID="ABCD" InterviewerID="FieldInt1" PendResult="4098" TimeStamp="2014-02-27T14:03:37Z">
<QuotaHistory RespondentID="EFGH" InterviewerID="FieldInt1" PendResult="4098" TimeStamp="2014-02-27T14:39:37Z">
</QuotaCell>
</Quota>
See also