7 Replies Latest reply on Nov 23, 2015 1:14 AM by mhd2307

    value list based on a condition

    mhd2307

      Goodmorning,

       

      I have a table of real estate properties. Some of them are ‘active’ (a field in the same table), some are not.

      How can I create a value list which only displays the properties which are active - based on the condition: the_active_field = ‘yes’?

       

      Thank you.

        • 1. Re: value list based on a condition
          keywords

          Create a relationship which uses the_active_field as a match key to your properties table. Then create a value list to show only related values, starting from the file where the_active_field is.

          • 2. Re: value list based on a condition
            dtcgnet

            This could fail depending on what's in the_active_field (which I'll call status). If Status contains Yes if active and is empty when not, then the relationship will give you the filter you need. If Status contains Yes if active and No if not active, then all of the records will be related and you won't see only the ones you want.

             

            mhd2307...keep the above in mind and keywords' method will work well.

            • 3. Re: value list based on a condition
              mhd2307

              Hi,

               

              So I make a second instance of the table in question and link both field to each other.

              Then, in the value list I make sure to use 'values from field' making sure I'll choose the field from the second instance table in the left hand list of the dialog.

              I also click 'Include only related values starting from', and select the original table.

               

              correct?

               

              Thanks.

              • 4. Re: value list based on a condition
                jgomes384

                I had a similar predicament in which I wanted to show only "Active" employees in a dropdown list. What I wound up doing was creating an Employee name field (EmployeeActive) which did the following:

                If ( Employees::Status = "Active" ; Employees::FullName ; "" ).

                 

                I then created a dropdown list based on the EmpID and EmployeeActive.

                 

                The result was that only Active employees showed in the list.

                 

                Perhaps you could replicate this with your solution.

                 

                Thanks,

                Jason

                • 5. Re: value list based on a condition
                  keywords

                  If by "instance of the table" you mean Table Occurrence (TO) then, yes, that sounds like you've got the idea. For a field like Active, which is essentially a boolean (true/false) field, it is worth considering making that a number field where 1 = true and 0 or empty = false. On your layout you can set a boolean field to display as "yes" even though the actual value in the field is 1.

                  • 6. Re: value list based on a condition
                    bigtom

                    keywords has good advice here. Use 1s and 0s. I at one time had a ton of value lists for things like this (checkboxes and yes/no fields). Bad idea. Using 1s and 0s you can test boolean as well as use 1s only and test for IsEmpty(). Much easier to work with over time.

                    • 7. Re: value list based on a condition
                      mhd2307

                      Thanks all for your constructive ideas. It's appreciated.