Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nboccassini
Partner - Creator
Partner - Creator

Get listbox values in extension

Hi,

can you explain me how I can get the values (text) from a qlik listbox in a script.js of an extension?

Thanks,

Gab

1 Solution

Accepted Solutions
nboccassini
Partner - Creator
Partner - Creator
Author

I have solved.

var doc= Qv.GetCurrentDocument();
var lb = doc.GetObject("LB01");

    texta=lb.Data.Rows[1][0].value;

The last problem is that this solution work in access point, not in desktop version (Error Data.Rows.1.0 is null or not a object

View solution in original post

3 Replies
tresesco
MVP
MVP

nboccassini
Partner - Creator
Partner - Creator
Author

I want only the Age values and I have created these lines in Definition.xml

  <Dimension Label = "Age", Initial="Age" TargetName="Age"/>

      <Measurement Label="Age" Initial="Age" TargetName="Age" />

Can you explain me how use these lines in my script.js (attached)? I want to give (the first value) in the variable texta (of my script.js)

function InitSettings() {

// General Settings

// Chart Object ID: used to create a Unique Chart ID

_this.ExtSettings.UniqueId = _this.Layout.ObjectId.replace("\\", "_");

// Use _this.ExtSettings.Color in your main script if you want to setup the color of something.

_this.ExtSettings.Color = _this.Layout.Text0.text;

}

function InitData() {

  

    var dataset = [];

    for (var i = 0; i < _this.Data.Rows.length; i++)

    {

          var vMaker    = _this.Data.Rows[0].text;

          var vModel    = _this.Data.Rows[1].text;          

          var vType      = _this.Data.Rows[2].text;

          var vSales = parseInt(_this.Data.Rows[3].text);

      

          // I just put all data from the row into one node.    

          dataset.push({"Maker":vMaker , "Model":vModel    , "Type":vType      , "Sales":vSales , "index":i});

    }

nboccassini
Partner - Creator
Partner - Creator
Author

I have solved.

var doc= Qv.GetCurrentDocument();
var lb = doc.GetObject("LB01");

    texta=lb.Data.Rows[1][0].value;

The last problem is that this solution work in access point, not in desktop version (Error Data.Rows.1.0 is null or not a object