Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
QLIKWORLD LIVE! MAY 16 - 19TH, EARLY BIRD DISCOUNTS! REGISTER TODAY
cancel
Showing results for 
Search instead for 
Did you mean: 
janvimehta45
Contributor
Contributor

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

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

0 Replies