2 Replies Latest reply: Oct 9, 2012 10:00 AM by bhancerli RSS

    Using Slider/Calendar Object to set constraints in data input

      Hı Qlikview experts.


      I would like to use a calandar object as an input where the user specified value will be used to constraint the data selection in SQL.


      In the code below, I would like the user to insert the start and finish dates and I would like the code to check the variable in the calendar object on the sheet.



      LOAD *;



      SQL SELECT ol_or_no1, ol_or_no2, ol_sr, ol_ma_kod AS ma_kod, ol_qty, ol_kapa, ol_ds_kod AS desen, ol_vry AS varyant, ol_plan_onay, date(ol_wrk_basdt), date(ol_onaydt),date(ol_terdt),

                                     ol_or_anhno, ol_onay2, date(ol_onay2dt),or_pe_no, or_anhno, or_rr_no

                FROM DBA.ordln

                JOIN DBA.ord

                ON ordln.ol_or_anhno = ord.or_anhno

                WHERE ol_kapa = 'A' AND (ol_onaydt BETWEEN '2012-01-01' AND '2012-10-08')

                order by ol_or_no2, ma_kod, desen, varyant



      Is there any way I could do this??


      Thanks a lot,



        • Re: Using Slider/Calendar Object to set constraints in data input
          Roberto Postma

          Hi bhancerli,


          While it is possible to have the SQL-code filtered by the value of the slicers (in fact the variables connected to the slicers), I think this is probably not what you need (because when used this way, everytime you change the slider value, you have to do a reload to get the right collection of records).


          The normal behavior is to load the full set (or the set you need to analyse) into Qlikview, where you can use sliders to filter your representation (e.g. show only data where the date of your field ol_onaydt is between your slicer values).


          Some sample code for this would be:

          sum( {<ol_onaydt =">=$(=yourSlicerVar1)<=$(=yourSlicerVar2)">} YOUR_MEASURE_FIELD)


          In this case, when you change the sliders, this is immediately reflected in your charts / tables.

            • Re: Using Slider/Calendar Object to set constraints in data input

              In fact I want to reload the data everytime. The purpose is to limit the data that's pulled from the external database.


              The data is large so I want the user to specify the date range before loading the data.


              Since I am pretty new to Qlikview could you explain me how do I declare those variables? The only place I saw to create new variable was in the input box. Is there a way I can get put the calender object and allow the user to select start and end dates there as input variables?