mobilemovilizer

How to branch a menu that is in a complex grid UI


We are trying to create a large menu in movilizer to support all our options, while doing so we are using a grid complex UI to support larger devices.

Because we use the complex grid UI we currently have 3 menu's and 2 text fields in our complex grid. However we cannot use the menu to branch to different movelets that are called after pressing the buttons in those menu's.

<question key="Q003" type="6">
    <answer attributeType="14" 
        key="A003_1" 
        nextQuestionKey="Q407"
        <text>menu1button</text>
    </answer>
    <answer attributeType="72"
        key="A003_5"
        nextQuestionKey="Q004">
        <predefinedValue>X</predefinedValue>
    </answer>
    <complex linearGroupId="Information" gridGroupId="gridMenu" gridHorizontalLayout="false" linearPos="1" gridPosX="0" gridPosY="1" groupTitle="menuGrid"/>
</question>

<question key="Q004" type="6">
    <answer attributeType="14" 
        key="A004_1" 
        nextQuestionKey="Q408"
        <text>menu2button</text>
    </answer>
    <answer attributeType="72"
        key="A004_3"
        nextQuestionKey="Q005">
        <predefinedValue>X</predefinedValue>
    </answer>
    <complex linearGroupId="Information" gridGroupId="gridMenu" gridHorizontalLayout="false" linearPos="2" gridPosX="1" gridPosY="1" groupTitle="menuGrid"/>
</question>

This example excerpt from our code will throw an error saying branching is not allowed for question Q003, however we need these seperate menu's.

Is there any way to circumvent this problem without having to create different movelets for each menu?

Thanks in advance!


Solution

  • you can only achieve this using MEL scripts. Basic idea is:

    1. you save the selection for all menus that are in the complex UI via MEL scripts
    2. all answers in the first Q in the complex UI link to the second question in the complex UI
    3. all answers in the second Q in the complex UI link to the third question of the complex UI ... and so on
    4. The last question of the complex UI links to an epsilon screen
    5. The epsilon screen uses restrictions that check the selection of the different menus to branch the flow accordingly

    This can then look something like this (simplified), Q003:

    <question key="Q003" type="6">
    <answer key="A003_1"
            nextQuestionKey="Q004">
        <text>menu1button</text>
    </answer>
    <answer attributeType="72"
            key="A003_DEFAULT"
            nextQuestionKey="Q004">
        <predefinedValue>X</predefinedValue>
    </answer>
    <onEnterAssignment>
        $local:selections = null;
    </onEnterAssignment>                
    <onLeaveOkPersistAssignment>
        $local:selections["Q003"] = getQuestionKey();
    </onLeaveOkPersistAssignment>
    <complex linearGroupId="Information" gridGroupId="gridMenu" gridHorizontalLayout="false" linearPos="1" gridPosX="0" gridPosY="1" groupTitle="menuGrid"/>
    </question>
    

    Q004:

    <question key="Q004" type="6">
    <answer key="A004_1" 
            nextQuestionKey="QEPS">
        <text>menu2button</text>
    </answer>
    <answer attributeType="72"
            key="A004_DEFAULT"
            nextQuestionKey="QEPS">
        <predefinedValue>X</predefinedValue>
    </answer>
    <onLeaveOkPersistAssignment>
        $local:selections["Q004"] = getQuestionKey();
    </onLeaveOkPersistAssignment>
    <complex linearGroupId="Information" gridGroupId="gridMenu" gridHorizontalLayout="false" linearPos="2" gridPosX="1" gridPosY="1" groupTitle="menuGrid"/>
    </question>
    

    And QEPS (which does the branching, very simplified):

    <question key="QEPS" type="41">
    <answer key="AEPS_1" 
            nextQuestionKey="END"/>
    <restriction position="0" nextQuestionKey="Q003">
        <condition>$local:selections["Q003"] != $answer:"A003_DEFAULT" ?OR $local:selections["Q004"] != $answer:"A004_DEFAULT"</condition>
    </restriction>
    </question>