0 Replies Latest reply: Jan 12, 2018 12:33 PM by Janvi Mehta RSS

    setStringValue method gives an error: Cannot read property 'getVariableByName' of undefined

    Janvi Mehta

      I am new to QlikSense. I have been trying to resolve this issue for a whilea nd couldn't find solution anywhere. I am using QS 3.0.1.

      I am trying to dynamically set variable by fetching it from url. Code below;

       

      var searchParams = window.location.search.substring(1,window.location.search.length);

        var searchArray = searchParams.split('&');

        console.log('params',searchArray);

        //update theme

        searchArray.forEach(function(param)

        {

        console.log('params',searchArray);

        var chartVar = param.split('=');

        if(chartVar && chartVar[0] && chartVar[1])

        {

        if(chartVar[0] == 'year')

        {

        console.log(chartVar[1]);

        app.variable.setStringValue('vYear',chartVar[1]);

        } else if(chartVar[0] == 'region')

        {

        var region = chartVar[1].replace('_',' ');

        console.log(region);

        app.variable.setStringValue('vRegion',region);

        } else if(chartVar[0] == 'commitee')

        {

        var commitee = chartVar[1].replace(/_/g,' ');

        console.log('commitee name:'+commitee);

        app.variable.setStringValue('vCommittee',commitee);

        }

        }

        });

       

      qliksenseissue.PNG