7 Replies Latest reply: Nov 19, 2013 2:36 PM by OLEKSANDR NERUSH RSS

    Variable number of Dimensions and Measures in an extension

    Erik Wetterberg

      With QlikView 11 SR1 we have added improved support for extensions with a variable number of Dimensions and Measures in your extension. If you want the user to be able to add Dimensions and Measures to your extension you use the Multiple attribute of Dimension and Measure tag.

       

      This might look something like this:

       

          <Dimension Multiple="" Label="Dimensions:" TargetName="Dimension" Initial="" />

          <Expression Multiple="" Label="Expressions:" TargetName="Expression" Initial="" />

      As a result you will get something like this property dialog:

      Extension1.png

      The user will then be able to add Dimensions and Measures with the plus button, remove them with the minus, and edit the definition. You don't have to use both: if you want your extension to support a variable number of Dimensions but only one Measure, you put the attribute just on the Dimension tag.

       

      Your javascript code must of course take into account that you do not now how many columns you have. A simplified version:

           for (var rowIx = 0; rowIx < this.Data.Rows.length; rowIx++) {

              var row = this.Data.Rows[rowIx];

              html += '<tr>';

              for (var colIx =0; colIx < row.length; colIx++){

                  html += '<td>'+row[colIx].text+'</td>';

              }

              html += '</tr>';

          }

       

      I've attached a very small example of this.

       

      In QlikView 11 SR1 you also get improved possibilities to set up the ordering of dimensions. If the user clicks the cogwheel icon, she will get this dialog:

      Extension2.png

       

      Hope you find this useful.

       

      Erik

        • Variable number of Dimensions and Measures in an extension
          Jérémy George

          Is there a way to add, remove and reorder dimensions and expressions ? It would be very handy....

          • Re: Variable number of Dimensions and Measures in an extension

            Hi Erik,

             

            Thanks for sharing the technique on how to add multiple measures in the Qlikview Extension object.

             

            1. Is there a way to change the label of the dimensions / measures when the multiple attribute is added on the Dimension and Measurement tags ?

             

            2. Can we add a More button which shows up a panel and allows us to modify the properties for the added dimensions / expressions ?

              • Re: Re: Variable number of Dimensions and Measures in an extension
                Stefan Walther

                Create a custom qvpp, let's say "MyProperties.qvpp", add the following line in the definition.xml

                 

                <PropertiesPage Version="11" File="MyProperties.qvpp" />

                 

                and then add the following code at the appropriate position in the MyProperties.qvpp file:

                 

                <div class="prop-grid_container accordion-shadow-enabler">

                      <div class="prop-bar-chart-header-clickable" avq="prop_listheader:.Chart.Dimension">Dimensions</div>

                      <ul avq="list:.Chart.Dimension" class="prop-dyn-sortable" name="sortable-dimensions" data-list-type="sortable-dimensions">

                        <li class="ui-state-default prop-sortable-list-li" name="chart-dimension" avq="TabSource:.:ChartTableDimensionFoldout.qvpp">

                          <span class="prop-sortable-list-arrow-position" avq="list_movehandle:"></span>

                          <div class="prop-sortable-width-239px" avq="prop_dynamicDropdown:.Field"></div>

                          <div class="prop-sortable-right-width-28px">

                            <div class="prop-sortable-width-28px" name="sortable-list-item-close-button" propicontype="delete-row" avq="prop_buttonjqui:.Remove"></div>

                          </div>

                        </li>

                      </ul>

                      <div class="prop-bar-chart-header-clickable" avq="prop_listheader:.Chart.Expression">Expressions</div>

                      <ul avq="list:.Chart.Expression" class="prop-dyn-sortable" name="sortable-measurements" data-list-type="sortable-measurements">

                        <li class="ui-state-default prop-sortable-list-li" name="chart-measurement" avq="TabSource:.:ChartTableMeasurementFoldout.qvpp">

                          <span class="prop-sortable-list-arrow-position" avq="list_movehandle:"></span>

                          <div class="prop-sortable-width-239px" avq="prop_editexpression:.0.Definition"></div>

                          <div class="prop-sortable-right-width-28px">

                            <div class="prop-sortable-width-28px" name="sortable-list-item-close-button" propicontype="delete-row" avq="prop_buttonjqui:.0.Remove"></div>

                          </div>

                        </li>

                      </ul>

                 

                      <div class="prop-grid_clear prop-grid_prepend-11 prop-grid_span-4 prop-grid_standard-height prop-less-more-button">

                        <button class="prop-grid_button prop-grid_span-4 prop-more-less-button" avq="foldOutMenuButton:" name="barchart">More...</button>

                        <button class="prop-grid_button prop-grid_span-4 prop-more-less-button" avq="foldOutMenuButton:" name="barchart" isless="true">Less..</button>

                      </div>

                 

                    </div>