4 Replies Latest reply: Mar 13, 2016 8:54 AM by Stefan Wühl RSS

    Select only sequences data

    Ant�nio Vilares

      Hi,

       

      I do not know if it's possible but I want that user of my qlikview application is only be able to select the data continuously.


      Imagine this example:


      The field represents the days of the month.


      I do not think that makes sense can select days that are not followed each other , as shown in the image.


      erro1.PNG

      I want to ensure that he can only select the days sequentially , as in the following image:

      erro2.PNG

      Is there possible?

      Thanks


        • Re: Select only sequences data
          Stefan Wühl

          Maybe using a field event OnSelect trigger (set in Settings - Document Properties - Triggers) with a Selection - Select in field action:

           

          expression for 'Field':

          =If(Count(DISTINCT Day) <> (Max(Day)-Min(Day)+1), 'Day')

           

          search expressions:

          =Min(Day)

           

          So if you select not a sequence of days, the selection reverts back to the min /start day selection (this could be changed of course to some other selection, or clearing the selection by returning an empty string).

          You can also use above expression conditional for Field to show / hide just a text box as an alert, without changing user selections.

           

          Hope this helps,

          Stefan

            • Re: Select only sequences data
              Stefan Wühl

              You can also use this search expression to revert the selection back to the previous selection:

               

              ='=Sum({$1} 1)'

               

              So if the user makes a sequence selection, then adds another day value, the previous selection will be restored if the new selection is not a continuous sequence, so he does not lose his previous selection.

                • Re: Select only sequences data
                  Digvijay Singh

                  Hi Stefan,

                       This is really great stuff, thanks!

                  Understood use of $1 to filter to last selection as I could recall but couldn't figure out how Sum(1) expression is properly selecting in field?

                    • Re: Select only sequences data
                      Stefan Wühl

                      That's basically just a shortcut to use a set of values defined by a set expression as search expression.

                       

                      The syntax defines an advanced search, similar to =Sum({<Year = {2014}>} Sales) > 10000, so you may understand it better if I would write an avanced search like

                      =Sum({SET} ConstantValue) > 1

                       

                      so only records related to the defined SET return a value > 1.

                       

                      Attached the sample with the above mentioned search expression and an alert text box to help the user understand the revert action.