Qlik Community

QlikView Integration

Discussion Board for collaboration on QlikView Integration.

Announcements
QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Highlighted
somenathroy
Contributor III

Problem with GetText() function in Extension

Dear All,

I am trying to learn QV Extension object with some basic examples. My requirement is to fetch value/text shown in a standard QV object. An expression [=Sum({<year={'2013'}>}Sales)] has been written in a standard QlikView Text Object. Now Text Object is showing a value 100.

My intention is to popup this value 100.

Please note that below code that has been written in Script.js file :

Qv.AddExtension('TextExtension',

        function () {

  var html = "<table><tr><td><input type='submit' name='txtSubmit' value='Submit' onclick='OnBtnClick()'></td></tr></table>";

  this.Element.innerHTML = html;

       

window.OnBtnClick = function()

  {

  var mydoc = Qv.GetCurrentDocument();

  var myObj = mydoc.GetObject("TX01");

  alert(myObj.GetText());

  }

  });

I am getting the follwing error message:

error.png

Any help would be highly appreciated.

Thanks & Regards,

Som

Tags (1)
1 Reply
Not applicable

Re: Problem with GetText() function in Extension

Hey Som,

you can't use the methods GetObject() like you did. You must give the method a callback function. In there you have access to the value of the Object.

So, your code must look like this:

window.OnBtnClick = function() {

  var mydoc = Qv.GetCurrentDocument();

  mydoc.GetObject("TX01", function () {

       alert(this.GetText());

  });

}