Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
somenathroy
Creator III
Creator 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

1 Reply
Not applicable

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());

  });

}