Condition Editor

A conditional form performs one or more checks, each of which is called a test in Ensemble. If the test or tests are not successful, the questions of the conditional form are skipped, and the subject is directed to the next form in the experiment. A form is made conditional by first assigning one of the conditional form handlers (form_conditional.php or form_conditional_s.php) to the form in the Experiment Editor, and then assigning tests to the form. The tests are assigned by clicking on the "X" in the "cond" field of the conditional form in the Experiment Editor. Note that the tests will only be assigned to the form for this particular experiment. If the form is reused in another experiment, the tests must be reassigned if the form is also made conditional in the other experiment.

Each test assigned to the form is associated with a response made by the subject to a question from a previously visited form. For example, a test might be associated with a question such as the one illustrated below, which displayed on a form preceding the conditional form in the experiment.

Example 1:

Are you left or right handed?

Left Right Ambidextrous

 

The test might require that the person answer "Left" or "Right", but not "Ambidextrous" on this previous form in order for the conditional form to display. If the test doesn't pass (the subject entered "Ambidextrous"), the conditional form is skipped and the subject is directed to the next form. Multiple tests may also be assigned to the conditional form. Each test corresponds to a different question in the experiment. The questions associated with the tests of a conditional form do not need to occur on the same form. Every test must pass in order for the conditional form to display (i.e. the logic used between tests is AND, not OR)

The Condition Editor is launced by clicking the "X" in the Cond. field for the form in the Experiment Editor.

The window of the Condition Editor first appears blank except for a menu on the right to add forms. Each form which precedes the conditional form in the experiment is listed. Forms may be previewed in order to view them before adding them. Clicking on "Add Form" adds an entry in the main window of the editor. The entry corresponds to a single test for the conditional form.

Information for the test first appears in red text, indicating that it hasn't been submitted to the database yet. The first question which occurs in the form is selected by default, and checkboxes for the answers to the question appear at the top. Selections are generally made in the following order. Your selections produce a condition code which is submitted to the database. The order which the fields are listed here make the code easier to decipher when matching tests.

To make all of the proper selections for your test, follow the precedure below.

1. (non-trial-based forms) Under "Form Occurrence." select the relative form order of the form where the test should be performed. If it was the last form, select "1 previous form." If it was the form before last, select "2 previous forms" and so on. If this is a trial based form, keep this at setting at "1 previous form."

2. Select the question that corresponds to the test in the Question ID field. Note that if you change the question, the checkboxes corresponding to the enumerated answers change at the top.

3. If this is a trial based form, then select "Yes" for the trial form line. If not select "No". This will direct the test to check for a response based on the sequence of trials rather than forms.

4. Select the Form Question Number. If the question only appears once on the form (most questions do), then you will not be able to change the value here and can move on.

5. Select the subquestion (if applicable). If this is a one-part question then the value will not be changeable.

6. (Trial-based tests only) Enter the relative trial order of the test you wish to run (e.g. if the test is on the trial before last, enter "2 previous trials").

7. If you wish to match a form that corresponds to the same stimulus_id, then select "yes" for "Check Same Stim." If you also selected "1 previous forms" in Step 1, then the last occurring form with the specified form_id, question_id, subquestion number, question iteration AND which also matches the same stimulus_id will be tested. Any other forms (including those with the same form_id and question_id but with a different stimulus_id will be skipped. "2 previous forms" will match the form before the last one that matches all of the criteria.

8. Condition type indicates whether the response is an enum or otherwise. If it is an enum, select response_enum, otherwise select response_text. This tells the test to check the correct field where the response is stored. Currently, the Condition Editor only supports enum tests so the field can't be changed.

 

(Not yet submitted)

Question Text: Please rate your familiarity with the song you just heard.

UnfamiliarSomewhat FamiliarVery Familiar
Form Occurrence: previous forms
Form:
Is this a trial form?
Question ID:
Form Question Number:
Question Iteration:
Subquestion:
Trial Order: previous trials
Check Same Stim:
Condition Type: response_enum


After you have made all of your selections, click the "Submit" button. You can also remove tests by clicking the "delete" button for that test. You may add as many tests as you like by repeating the procedure above.

Condition Codes This section provides information on the underlying mechanism for conditional forms and you should be able to create your condition tests solely by using the condition editor. This is provided form informational purposes.

The Condition Editor produces codes in the condition field of the experiment_x_form table in the following format.

form_occurence, form_id, trial_form, question_id, form_question_num, question_iteration, subquestion, trial_order, <same_stim>, condition_type, responses

Field Descriptions form_occurrence: the relative order which the form with a specific form_id occurred to the current form, or an absolute occurrence. For example, -1 means the last occurrence of this form, -2 means the occurrence before the last, and 2 means the second occurrence in the entire experiment.

form_id: the form_id for the form where the question was encountered.

trial_form: A boolean value which indicates whether the question is part of a trial or not. 0 means the question occurs on a non-trial form, 1 means the question occurs on a trial form.

question_id: the question_id of the question.

form_question_num: the order which the question occurs on the form (field of the same name in the form_x_question table). If a trial question, this should be 0.

question_iteration: the iteration of the question (question_iteration field in the form_x_question table). If a trial question, this should be 0.

subquestion: the subquestion number of the question (field of the same name in the question_x_data_format table).

trial_order: relative trial order to the previous trial. For example, if this is a response to the last trial, enter -1. if it's a previous response to the current trial, enter 0. If this is not a trial question, this should be 0.

<same_stim>: if the question refers to the same stimulus id, the string "same_stim" should be submitted. Otherwise, 0 is submitted.

condition_type: if this is an enum type response, this is simply the string "response_enum" (without quotes). If it's anything other than an enum, enter the string "response_text" (without quotes).

responses: the responses which are required in order for the test to pass. Multiple responses are separated by commas. For instance, if the test passes when enum values 2 or 4 are made, "2,4" (without quotes) are entered at the end of this list.

As an example, let's assume that the test depends on the response for Example 1 above. Let's say the question has the following properties: form_id=56, question_id=4, form_question_num=2 (the second question on the form), subquestion=1(it's a single question). The answer format is an enum type. We're interested in the response to this question on the last occurring form with form_id=56. The question isn't associated with a stimulus, so 0 is entered. Finally, in this case let's say the test passes if the subject response is "Right" or "Ambidextrous." The entry for the test would look like the following:

Example 2:

-1,56,0,4,2,1,0,0,response_enum,2,4

-1 tells us to look at the last occurrence of the form with a form_id equal to 56. It's not a trial form so a "0" is entered after the form_id. We are interested in the response for question_id=4, which is the second question on the form and we are looking at the first subquestion. If the answer made was "Right" (2) or "Ambidextrous" (4), then the test passes and the form is displayed. Recall that enum responses are 2 to the power of one less the enum order. So "Left" would be 2 to the zero power (1), "Right" would be 2 to the first power (2), and "Left" would be 2 to the second power (4).

Conditional forms which depend on responses to multiple questions are also possible. This is simply done by using the format above for each question, separating the information for each question with a carriage return. For example:

Example 3:

-1,56,0,4,2,1,0,0,response_enum,2,4
1,52,0,2,1,1,0,same_stim,response_text,5,6,7,8,9,10

The first test (the first line) is identical to the test in Example 2. Let's assume that the second test was a rating made by the subject on a scale from 1 to 10 and a stimulus was associated with the question. Since the response is of type int, this is actually stored in the response table as response_text. Basically, anything that is not a response_enum is response_text, regardless of whether it is a string, int, float, or something else. The example above looks at the first response to the question in the experiment, and requires that the subject entered a number from 5 to 10 in order to pass. All tests in a condition must pass in order for the form to display.

bottom corner