set-attribute

The set-attribute element can be used within a question page to set the value of an attribute within the entity specified for the page, without asking the user a question. This can be used in scenarios where you know what value to set because of the page you are on. An example of this would be if you had a page at the start of your script which is used to capture the primary person (usually the person filling in the details for this script), and want to be able to distinguish that person from the rest of the people you capture. To do this, you could have an attribute in the Person entity called 'isPrimary' and set it to true on the primary person page as follows:

Figure 1. set-attribute XML
<question-page id="AboutYouPage" entity="Person" 
          criteria="isPrimary==true">
          <set-attribute id="isPrimary" expression="true" />

You can either have a set-attribute which sets isPrimary to false on the pages capturing other people, otherwise, you can set the default value for isPrimary to false in the schema definition.