3 Replies Latest reply: Nov 12, 2012 12:54 PM by LEWIS GOLDSTEIN RSS

    Next and Prev Button for moving through an incomplete Set

      I have created a "Next" and "Prev" Button to move through subsets of a range.  Range is based off field called SEGMENT.  SEGMENT can have values of 1 - 32, but sometimes there are missing SEGMENTS within the range.  I have a Chart, with X-Axis of SEGMENT, that can be configured to display between 1 - 4 segments at a time utilizing variable vSegmentInterval.

       

      My "Next" Button seems to work perfectly regardless of number of segments displayed -- even in cases of missing Segments.  What follows is the expression I am utilizing for my "Next" Button.

       

      =If(MIN(SEGMENT)<= MAX(SEGMENT)

          ,'>=' & (MIN(SEGMENT)+1) & '<=' & (MIN(SEGMENT)+vSegmentInterval)

      )

       

      What I can't seem to figure out is the correct expression for my "Prev" Button.  At best I can get "Prev" working when I am only displaying 1 segment at a time, but even then, if there is a missing segment, as soon as I hit the missing one when I select "Prev" all my selections for other fields seem to get corrupted.  Seems to me this should be a simple Expression, but I am at a loss

        • Re: Next and Prev Button for moving through an incomplete Set

          To Clarify, in the below example the box represents the range of values in field SEGMENT I want to display in my chart.  "Next" and "Prev" Button should move the set in the box up or down the sequence -- note that there are missing values in the range.  Assumption in this example is vSegmentInterval = 4.

          range.bmp

           

            • Re: Next and Prev Button for moving through an incomplete Set

              On looking at this again I now believe my "Next" Button Expression is incorrect as well.  Although it is taking me to the next set of SEGMENTS, it is actually deselecting the previous SEGMENTS, rather than just moving my window to display the next set.  Next and Prev Button should only be a rolling window over the selected set of SEGMENTS, it should not be deselecting any values.  Is this even doable?

               

              Should work similar to scrolling.  Reason for this implementation is I have layered bar charts that must scroll in unisom; as there is no Qlikview built in methodology to tie the X-Axis from multiple charts together I had to resort to this implementation.  In addition to the "Prev" and "Next" Buttons I have a Slider based off of the common X-Axis.  It works slightly better than my Next and Prev Buttons, but it also gets confused when the slider hits a missing SEGMENT and like the Next and Prev Buttons is also selecting and deselecting SEGMENTS to accomplish the scroll rather than providing a moving window over the SEGMENTS.

               

              Message was edited by: Lew Goldstein

                • Re: Next and Prev Button for moving through an incomplete Set

                  Digging through other Discussions I found an Expression I was able to leverage that works for my "Prev Button" when an empty set exists in the date range:

                   

                  =IF(ISNULL(AVG({$<DATA_TS={'$(=max({1<DATA_TS={"<$(=max(DATA_TS))"}>} DATA_TS))'}>}DISKAVG))
                  ,
                  DATE(MAX(DATA_TS)-2)    
                  ,
                  DATE(MAX(DATA_TS)-1)
                  )

                   

                  I must admit I don't totally follow the logic here, but it works; except in cases when multiple consecutive empty sets. Hoping to get better understanding of this expression so I can make it work for "Next Button" as well.