Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Standard QlikView objects have a variable number of dimensions and expressions: it is possible to add or remove them in their properties page. Extensions objects however must provide a definition.xml file specifying a static number of dimensions and expressions, but if there is no properties.qvpp file to define the properties page of the extension then the standard properties page allowing to add/remove dims and expressions is shown and works as expected.
How can I have a extension object with its own properties.qvpp while allowing a variable number of dimensions or expressions?
Yes, it is possible.
In Definition.xml you set the initial number of dimensions. If you want the extension to have two dimensions when the object is created you define two Dimension rows:
<Dimension Label="Dimension 1:" Initial="" />
<Dimension Label="Dimension 2:" Initial="" />
In your qvpp file you add a button for adding dimensions:
<button avq="action:.Chart.Dimension.Add" >Add Dimension</button>
On each dimension you add a remove button:
<input class="ToolProperty-TxtSelect" style="width:140px" avq="text:.Chart.Dimension.0.Field" />
<button avq="dropdown:.Chart.Dimension.0.Field" class="ToolProperty-TxtSelectMenu" ></button>
<button avq="action:.Chart.Dimension.0.Remove" >Remove</button>
Yes, it is possible.
In Definition.xml you set the initial number of dimensions. If you want the extension to have two dimensions when the object is created you define two Dimension rows:
<Dimension Label="Dimension 1:" Initial="" />
<Dimension Label="Dimension 2:" Initial="" />
In your qvpp file you add a button for adding dimensions:
<button avq="action:.Chart.Dimension.Add" >Add Dimension</button>
On each dimension you add a remove button:
<input class="ToolProperty-TxtSelect" style="width:140px" avq="text:.Chart.Dimension.0.Field" />
<button avq="dropdown:.Chart.Dimension.0.Field" class="ToolProperty-TxtSelectMenu" ></button>
<button avq="action:.Chart.Dimension.0.Remove" >Remove</button>
And there is another possibility. You can use the Drag and Drop funtionality. In your Definition.xml you write like this:
<Dimension Label="Dimension 1:" TargetName="Dimension 1" Initial=""/>
<Dimension Label="Dimension 2:" TargetName="Dimension 2" />
<Expression Label="Expression 1:" TargetName="Expression 1" Initial="" />
Dimension 1 will be initialized, and you can drag fields from the 'Select fields...' dialog to your extension and add new dimensions or replace existing ones.
Thanks a lot for this information!
I tried both of your suggestions and it worked but I have trouble understanding how to deal with the properties page. If I add a "add dimension" button in my qvpp, how can I add the proper html elements to the properties page (i.e. label and field to allow the user to select the 2nd dimension) once the button is pressed?
Are there helpers functions introduced in v11 that allow interaction with the properties page? I remember that in v10 the only way to add dynamic behavior to the properties page was to rely on inline javascript in the qvpp file and it became a mess very quickly...
OK, here is a third suggestion:
You can use avq="list:.Chart.Dimesion". You place this attribute on a tbody tag. Inside the tbody you place a tr tag which works as a template. An example (ugly, but working) would be like this:
<table>
<tbody avq="list:.Chart.Dimension" >
<tr>
<td>
<input class="ToolProperty-TxtSelect" style="width:140px" avqcol="text:.Field" />
<button avq="dropdown:.Field" class="ToolProperty-TxtSelectMenu" ></button>
</td>
<td>
<button avq="action:.Remove" >Remove</button>
</td>
</tr>
</tbody>
</table>
To be able to add dimesions you still need a button:
<td colspan="2" class="ToolProperty-Literal" style="text-align: right;">
<button avq="action:.Chart.Dimension.Add" >Add Dimension</button>
</td>
Hope this helps!
Erik
I'll give it a try. You taught me a lot of useful things about qvpp. Is there a reference document with the list, meanings and use cases of the qvpp attributes? There was some documentation about it in v10 but it was far from complete. I was not able to find something similar in the QV11 SDK. Does such a reference exist?
Erik: Is it also possible to invoke the Chart.Dimension.Add action from the javascript code of an extension?