Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Can you use calculated dimensions in an extension?

Hi !

Anyone know if you can use calculated dimensions in a extension?

Thanks!
Mike

1 Solution

Accepted Solutions
Brian_Munz
Employee
Employee

First the bad news...

There is a bug in QV11 that makes it not possible to set up calculated dimensions in (at least) extensions.  The bug has been logged and will be fixed in a future SR.

Now the good-ish news....

There's a workaround (thanks to Erik Wetterberg) to hardcode the calculated dimension in the extension's Definition.xml file (which is found in the extension's folder).

So, if you wanted to do a calculated dimension on the first dimension of the extension, you'd add the following code toward the end of the Definition.xml:

<InitiateName="Chart.Dimension.0.Field" value="=1+1" />


The value is of course the calculated dimension.

Rather than constantly having to modify this file to test the calculated dimension in the extension, I'd suggest testing it on a regular qlikview object first to make sure it's solid before hardcoding it.

View solution in original post

7 Replies
Not applicable
Author

Ditto on Mike's question...

Any sage advice around how to deal with calculated dimensions when working with an extension?

Brian_Munz
Employee
Employee

First the bad news...

There is a bug in QV11 that makes it not possible to set up calculated dimensions in (at least) extensions.  The bug has been logged and will be fixed in a future SR.

Now the good-ish news....

There's a workaround (thanks to Erik Wetterberg) to hardcode the calculated dimension in the extension's Definition.xml file (which is found in the extension's folder).

So, if you wanted to do a calculated dimension on the first dimension of the extension, you'd add the following code toward the end of the Definition.xml:

<InitiateName="Chart.Dimension.0.Field" value="=1+1" />


The value is of course the calculated dimension.

Rather than constantly having to modify this file to test the calculated dimension in the extension, I'd suggest testing it on a regular qlikview object first to make sure it's solid before hardcoding it.

Anonymous
Not applicable
Author

Thanks for all of the information Brian !  I definitely appreciate it.

Just for competion, here's the Definition.xml file that I used to confirm that this works.  Note the space between the words Initiate and Name.  Also, the line Dimension Initial appears to be required for this to work too.

<?xml version="1.0" encoding="utf-8"?>

<ExtensionObject Label="My Extension Label">

<Dimension Initial=""/>

<Measurement Initial=""/>

<Initiate Name="Chart.Dimension.0.Field" value="=if(Name='One','One',NULL())" />

</ExtensionObject>

Not applicable
Author

You can also set a calculated dimension dynamically from the javascript code by doing:

this.Layout.SetProperty('Chart.Dimension.0.Field', "=if(Name='One','One',NULL())");

Anonymous
Not applicable
Author

Thanks for the tip George !  I'll have to give that a try

Bjorn_Wedbratt
Former Employee
Former Employee

Have you tried the following in Properties.qvpp?

<div class='prop-grid_clear prop-grid_prepend-1 prop-grid_span-5 prop-grid_standard-height prop-grid_label'>

        Expression

      </div>

      <div class='prop-grid_span-10 prop-grid_last prop-grid_standard-height'>

        <input class='prop-grid_checkbox prop-expression-input' type='text' style='width:94%;' avq='edit:.Chart.Dimension.0.Field' />

        <span propicontype='expression' avq='dlgprop:.Chart.Dimension.0.Field:Expression.qvpp'></span>

</div>

Not applicable
Author

Hey Brian,


I tried the suggested sample but its not working for me.

Here my Definition.xml file below:

<?xml version="1.0" encoding="utf-8"?>

<ExtensionObject Label="Google Maps" Description="Google Maps Marker" PageHeight="800">

          <PropertiesPage Version="11" File="" />

          <Dimension Label="Dimension" Initial=""/>

          <Dimension Label="Dim2" Initial="Test123" />

          <Measurement Label="Expression" Initial="" Multiple=""/>

          <Measurement Label="Expression2" Initial="" Multiple=""/>

          <Measurement Label="Expression3" Initial="" Multiple=""/>

          <Initiate Name="Chart.Dimension.1.Field" value="=if($(vShowRoute), [Last Known Location], [IDS Driver Assets]" />

</ExtensionObject>

Can you have a look and see what i'm missing?  "Last Known Location" & "IDS Driver Assets" are field name within my dashboard.