1 Reply Latest reply: Aug 1, 2013 2:38 AM by Gustav Gnosspelius RSS

    Why are all dates selected by my date picker?

      Hi,

       

      I have constructed a date picker by having two calendar objects. The first sets vSearchDateStart and the other vSearchDateEnd. These two date pickers then do selections to the field Created1_TASK. This is done by triggers as such (showing triggers for the datepicker for vSearchDateEnd):

       

      1. Set Variable vSearchDateStart: (this is a check to see that the end-date is not before the start-date)

      =If(vSearchDateStart > vSearchDateEnd, vSearchDateEnd, vSearchDateStart)
      

       

      2. Select in Field Created1_TASK:

      ='<=' & date(vSearchDateEnd) & '>=' & date(vSearchDateStart) 
      

       

      All works very well except when I select a date that is earlier than vSearchDateStart. If I do so then all dates in Created1_TASK are selected. This does not occur if I select the same value as in vSearchDateStart.

       

      I guess there is something wrong with the logic in the Set variable but I can't figure out what.

       

      Can anyone spot the problem?

        • Re: Why are all dates selected by my date picker?

          I managed to fix this myself. The problem seems to be that even though the Set Variable-trigger is before the Select in Field-trigger, the Select in Field-trigger still uses the old variable value. I solved it by adding an IF-condition to the Select in Field-trigger, see below (note new variable names):

           

          =if(vDateTaskCreatedStart > vDateTaskCreatedEnd, '>=' & date(vDateTaskCreatedEnd) &'<=' & date(vDateTaskCreatedEnd),'>=' & date(vDateTaskCreatedStart) &'<=' & date(vDateTaskCreatedEnd))