Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

neilfraser12a
New Contributor II

Finding selected time range from within an Extension

Hi,

I'm very new to Qlik Sense and am currently using the Desktop variant, version 3.2 SR4.

I have 2 line charts displayed on a single sheet, both of which use 'Time' as a dimension. When the user uses the Lassoo to select a time range, both charts display information only from that time range.

Within an extension, I would ideally like to be notified when the 'Time' range has been changed by the user but I don't think that this is possible. Assuming this is the case, from an extension I'd like to be able to do 2 things, both of which were simple using Qlik View.

  1. Identify all of the charts on the sheet with the dimension of 'Time' and create a list of measures across all of the graphs.
  2. Identify the 'Time' range that is currently selected by the user.

I've started by creating a Basic Visualisation Template and am looking to extend this. I've managed to do some simple things and have called the backend API successfully but I'm struggling with the points above.

Any pointers or guidance would be gratefully received,

Many thanks,

Neil Fraser

1 Solution

Accepted Solutions
erik_wetterberg
Honored Contributor

Re: Finding selected time range from within an Extension

Hi Neil,

Looks like a very common problem: changes to initialProperties (like adding a hypercube) does not affect existing objects. Remove your object from the sheet, add a new one and try again.

Hope this helps

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
5 Replies
erik_wetterberg
Honored Contributor

Re: Finding selected time range from within an Extension

Hi Neil,

If you use a HyperCube or a ListObject with 'Time' as a dimension you will be notified (that is your print method will be called) when selection state for the Time dimension changes.

Hope this helps

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/
neilfraser12a
New Contributor II

Re: Finding selected time range from within an Extension

Hi Erik,

Many thanks for the timely response. My understanding is that in order to access the HyperCube and the 'Time' dimension from my Extension, 'Time' would need to be declared as a dimension for that extension, which leads into my next question (sorry).

The extension I have started as a Basic Extension Template and I don't appear to be able to select a Dimension when using this template. My code contains the following, where the appearanceSection contains a few bespoke items I've added:

initialProperties: {

     qHyperCubeDef: {

          qDimensions: [],

          qInitialDataFetch: [{

               qWidth: 2,

               qHeight: 50

          }]

     }

},

definition: {

     type: "items",

     component: "accordion",

     items: {

          dimensions: {

               uses: "dimensions",

               min: 1,

               max: 1

          },

          sorting: {

               uses: "sorting"

          },

          appearancePanel: {

               items: {

                    appearance: appearanceSection

               }

          }

     }

},

When I Edit the sheet and select my extension, I can see the Dimensions section on the right and it says Add Dimension inside the extension. I select 'Add dimension' and the box appears from which I can select a dimension (see image). However, when I select 'time' it doesn't appear in the text box at the top, so I'm unable to add time as a dimension to this extension. Does the extension need to be created from a different template or is there something else I'm missing?

Extension.png

Many thanks,

Neil Fraser

erik_wetterberg
Honored Contributor

Re: Finding selected time range from within an Extension

Hi Neil,

Looks like a very common problem: changes to initialProperties (like adding a hypercube) does not affect existing objects. Remove your object from the sheet, add a new one and try again.

Hope this helps

Erik Wetterberg

Erik Wetterberg
https://extendingqlik.upper88.com/

Re: Finding selected time range from within an Extension

Often though, if you drag and drop the extension from the list on the left onto the extension being used in the middle then you can convert it to the new version of the extension.

Note:  Whilst this usually works it does not always work, especially if there are additions / removals to Properties Panel Items.  But when it does work it can save a lot of time deleting & recreating viz objects

neilfraser12a
New Contributor II

Re: Finding selected time range from within an Extension

Thanks Erik, that was exactly the problem. I removed the extension, added it back and I could then add a dimension, so now I just need to get the notification of the time selection and I'll have pretty much what I need.

Community Browser