4 Replies Latest reply: Oct 15, 2012 9:32 AM by Tiago Santos RSS

    One Listbox, Two Fields

      Hello.

       

      I have a couple of listboxes (year, month, day, ...) that I would like to use in order to filter two different (and unrelated) date fields in two different (and unrelated) tables.

       

      Is there a way to do this in QV10?

       

      Ah... and I can't have an expression like "TableAYear & TableBYear" in the Field of the Listbox :s

       

      Example:

       

      Table A:

      IdA DateA

      1 2009-06-01

      2 2011-06-05

      3 2012-06-15

       

       

      Table B:

      IdB DateB

      1 2010-07-12

      2 2011-08-01

      3 2012-09-29

       

      Having a listbox named "Year" with the values of the two tables (2009, 2010, 2011, 2012), I want to select 2011 and QV automatically select the values in table A and/or in table B.

       

      Thanks in advance

        • Re: One Listbox, Two Fields
          Celambarasan Adhimulam

          For this purpose use triggers Which is under document properties.

          Set a trigger on change for the field either Table A or Table B fields and then set the values using get current selections for the Select in field action.

            • Re: One Listbox, Two Fields

              If I have the listbox referencing DateA what would be my parameters in the "Select In Field"?

               

              Cause I've had set an action in the sheet properties:

               

              Actions: Select in Field

              Field: DateB

              Search String: =GetCurrentSelections(DateA)

               

              And even when I select a value in the listbox, DateB doesn't get selected =/

               

              What am I doing wrong?

               

              Thanks

              • Re: One Listbox, Two Fields

                After my initial problem was resolved, i am now facing another problem which is quite tricky (remember user selects fields "A" and fields "B" must have the same value but are "hidden").

                 

                Example:

                 

                YearA has:

                2009, 2010, 2011

                 

                YearB has:

                2009, 2010, 2011

                 

                So far, so good there the same years in both fields but from now on it gets bad...

                 

                MonthA has:

                January, February, March, April

                 

                MonthB has:

                January, March, July, September

                 

                 

                So, when I select the year 2010 in the "YearA" listbox, "YearB" gets the same value after the trigger implementation but it also gets July in the field "MonthB" since it's the only month with values for that year.

                If I select February afterwards in MonthA listbox, and with the trigger implemented, I would expected QV to "know" that MonthB has no "February" value so it would get Null but no... It remains with the July selection on even after the trigger "Select in Field" fires... :s

                 

                How can I fix this in QV10?