1 Reply Latest reply: Jun 30, 2017 11:46 AM by Hammond Mason RSS

    QlikView JavaScript API - Set Field to Listbox

    Florian Salfenmoser

      Hello everybody,

       

      I´m trying to set - or change - a field/dimension to a listbox via the QlikView JavaScript API.

       

      I can get it to work for a TableChart with:

       

      tableChartObj.Layout.SetProperty("Chart.Dimension." + d + ".Field", "MyDimension", true);

      (d starts from 0 to x and is the number/order of this dimension)

       

      Qlik gives the following possibilities for Dimensions to use with the SetProperty()-Function:

      https://help.qlik.com/en-US/qlikview-developer/12.1/Subsystems/Extensions/Content/extensions-properties-dimensions.htm

       

      But the documentation is bad as usual, so a lot of stuff is missing or wrong

       

      e.g. you can set the Label of an Expression via

       

      tableChartObj.Layout.SetProperty("Chart.Expression." + e + ".0.Label", "MyLabel" , true);


      which isn´t even documented in the help.

       

      I assume that even "Chart.Dimension." is wrong, because a Listbox is not a chart-object - at least in the VBScript API -.

       

      I tried several things like:

      listbox.Layout.SetProperty("Chart.General." + 0 + ".Field", "MyDimension", true);
      listbox.Layout.SetProperty("Field", "MyDimension", true);
      listbox.Layout.SetProperty("Chart.Field", "MyDimension", true);
      listbox.Layout.SetProperty("Chart.0.Field", "MyDimension", true);

       

      but nothing worked so far.

       

      Has anybody an idea or did this before?

       

      Thanks in Advance.

       

      Best regards

       

      Florian

        • Re: QlikView JavaScript API - Set Field to Listbox
          Hammond Mason

          Hi Florian.

           

          I appreciate it's been over a month since you posted, but I've only just started developing with QlikView Extensions and I've just come to this Forum.

           

          If I understand you, you're looking for a way to set the selection in a ListBox from within the Extension.  If this is correct, then I have done this using the following code:

           

          (function(myName) {

               mkr.on('click', function() {  

                _this.Data.SelectTextsInColumn(0, true, myName);

               });

              }(name));

           

          The key here is the SelectTextsInColumn function of the Data object.  The full Extension code is available from my GitHub repo. So you can see it work in practice.