5 Replies Latest reply: Jul 12, 2017 10:59 AM by Neil Fraser RSS

    Finding selected time range from within an Extension

    Neil Fraser

      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

        • Re: Finding selected time range from within an Extension
          Erik Wetterberg

          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

            • Re: Finding selected time range from within an Extension
              Neil Fraser

              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