7 Replies Latest reply: Jul 12, 2013 2:04 PM by Dat Tran RSS

Can you use calculated dimensions in an extension?

Mike Carpenter

Hi !

 

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

 

Thanks!
Mike

  • Can you use calculated dimensions in an extension?
    Thaumas Mathew

    Ditto on Mike's question...

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

    • Can you use calculated dimensions in an extension?
      Brian Munz

      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.

      • Can you use calculated dimensions in an extension?
        Mike Carpenter

        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>

      • Re: Can you use calculated dimensions in an extension?
        Dat Tran

        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.

  • Can you use calculated dimensions in an extension?
    Jérémy George

    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())");

  • Re: Can you use calculated dimensions in an extension?
    Björn Wedbratt

    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>