Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Branching with multiple questions involved

Hi ... I have a select question with 3 radio buttons and three open enders on one page - one for each radio button.  How do I adjust the code in the Branching question to cope with this scenario?  Any help gladly received.

I'm on the latest version of Lighthouse,
asked Jul 15, 2019 by Marion Bronze (3,770 points)

1 Answer

+2 votes
Best answer
I have just copied the RadioQ branching logic and pasted two more times so I have 3 sections with that logic.  Then just adjust the logic for each for the correct radio button value with the branching question you want shown.  So in my example below I have the radio button select question 'Branch3' and option 1 will then show the open end 'TestOPN1' and option 2 will show 'TestOPN2'.

$(window).on('load', function(){
    // Branching parameters
    var branching = [
            // show BranchQ if RadioQ = 1
            question: 'TestOPN1',
            test: SSI_GetValue,
            vars: ['Branch3'],
            result: 1,
            clear: true
        }, {
            // show BranchQ if RadioQ = 2
            question: 'TestOPN2',
            test: SSI_GetValue,
            vars: ['Branch3'],
            result: 2,
            clear: true                    
        }, {
            // show BranchQ if CheckQ_1 is checked
            question: 'BranchQ',
            test: SSI_GetValue,
            vars: ['CheckQ_1'],
            result: true,
            clear: true
        }, {
answered Jul 15, 2019 by Jay Rutherford Gold (36,215 points)
selected Jul 15, 2019 by Rajesh Rana
Wonderful!  I had the right idea, but didn't put commas in-between.  Thanks a heap!
I believe I made that same error the first time I did it as well.  Glad you got it sorted out.