4 Replies Latest reply on Dec 4, 2015 12:57 PM by BrentJohnson

    List by drop down field

    BrentJohnson

      This has probably been answered before, but I cannot find where.

      I have List View Layout. I want to only “list” stores associated with a specific Program (from a drop down list field).  I can do this the manual way, however I would like to do so automatically.

        • 1. Re: List by drop down field
          Mike_Mitchell

          Brent -

           

          What you will want to do is write a script that locates the records you need. Something like this:

           

          Set Variable [ $program ; dropDownListField ]

          Enter Find Mode [ ]

          Set Fields [ tableName::program ; $program ]

          Set Error Capture [ On ]

          Perform Find [ ]

          Set Error Capture [ Off ]

          If [ not Get ( FoundCount ) ]

               Show Custom Dialog [ "Error" ; "No records found for that program." ]

               Show All Records

          End If

           

          Once you've created this script, set it to execute as an OnObjectModify Script Trigger on the field where the drop down appears. That way, whenever someone makes a selection from the list, this script will run and automatically locate the correct records.

           

          HTH

           

          Mike

          • 2. Re: List by drop down field
            BrentJohnson

            Mike,

            That works GREAT!!!

            I do have another question  I have some records that have similar program names.  When I search for one of the programs, they all appear.

            Ex:

            Beach Diet

            Rare Beach Diet

            All the records from both programs are listed.  How can I make the find more specific.

            • 3. Re: List by drop down field
              Mike_Mitchell

              Change the script slightly:

               

              Set Variable [ $program ; dropDownListField ]

              Enter Find Mode [ ]

              Set Field [ tableName::program ; "==\"" & $program & "\"" ]

              Set Error Capture [ On ]

              Perform Find [ ]

              Set Error Capture [ Off ]

              If [ not Get ( FoundCount ) ]

                   Show Custom Dialog [ "Error" ; "No records found for that program." ]

                   Show All Records

              End If

               

              It's useful to get to know the various Find operators and how they work. They're in the toolbar when you're in Find mode:

               

              Screen Shot 2015-12-04 at 3.51.29 PM.png

              • 4. Re: List by drop down field
                BrentJohnson

                That worked great!!

                I was playing around with the Find operators and just could not figure it out

                Again, thank you much!