Skip to main content

QlikView Integrations

Discussion Board for collaboration on QlikView Integration.

Announcements
CUSTOMERS ONLY: Now accepting customer applications for the 2023 Luminary Program: SUBMIT NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
ErikWetterberg

Variable number of Dimensions and Measures in an extension

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

7 Replies
Not applicable

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

ErikWetterberg
Author

Yes.

Plus and minus-buttons are used for add and remove. If you press the arrow button on the left you can drag the dimension or measure up and down.

Erik

Not applicable

Sorry I wanted to ask: "Is there a way to add, remove and reorder dimensions and expressions using the javascript API ?"

I am working on an extension which requires expressions to have a specific format to work properly, and since there is no way to do something like that in the qvpp I hide those settings from the properties page and provide a wizard which sets the expressions using Layout.SetProperty(...). I am looking for a way to set the number of measures from the javascript (right now there are something like 7 measures defined in definition.xml, and I just get the data for the Nth first columns, which is a waste of bandwidth and processing power, but I did not manage to find a clever way to achieve that).

Not applicable

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 ?

alex_nerush
Partner - Creator II
Partner - Creator II

Hello jgeorge

Did you found a solution regarding adding dimensions and expressions using JavaScript?

Stefan_Walther
Employee
Employee

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>

alex_nerush
Partner - Creator II
Partner - Creator II

Hello Stefan! Thanks for help... but my question was about adding and removing dimensions and expressions using the javascript API (for Extension Object). I've found solution and have shared the idea: http://community.qlik.com/thread/99395 .


There is a new question: how can i determine the number of dimensions and expression from an Extension Object's code (using JavaScript)?

p.s. By the way, you have a great blog!!