6 Replies Latest reply on Dec 7, 2012 3:20 PM by philmodjunk

    Find "All" Value List



      Find "All" Value List


           I have a drop down list that performs a find for  project records that are either "Complete" or "Active". The result displays only projects that match that criteria. What I want to do is add "All" as a selection so when selected would display "Completed" and "Active" projects at the same time. I obviously don't want to add "All" to my value list because when a project is marked as "Complete" for "Active", "All" would display in the value list.

           My current set up:
           The drop down list is using a global field in the "Projects" table named "g_SearchProjectStatus" and using values from a "ProjectStatus" list. I created a variable script (see image) to "find".

           My thinking (to make this work) would be to create another value list containing "Complete", "Active" and "All" and use that instead of the current value list? Then modify my script to somehow perform a find for both values and thus becoming "All". Any help would be appreciated.


        • 1. Re: Find "All" Value List

               Are Complete and Active the only possible values in your field or could the field be empty?

               If the field is never empty and Active and Complete are the only possible values, then you can check for "ALL" in the field and do Show All Records instead of performing the find. If the field is empty for some records and you only want to find the records where the field is not empty, use an asterisk as the find criteria in the field.

               I'd script it this way:

               Enter Find Mode [] ---> clear the pause check box
               If [Projects::g_SearchProjectStatus = "All"]
                  Enter Browse Mode
                  Show All Records

                  Exit Script []
                  Set FIeld [Projects::ProjectStatus ; "*"]
                  Set Field [Projects::ProjectStatus ; Projects::g_SearchProjectStatus ]
               End If
               Set Error Capture [on]
               Perform Find []

               Depending on the data in your table as I have discussed at the beginning, use either the blue script steps or the Red Script step, but not both. (If I used Show All records, I'd probably simplify this script by not entering Find Mode before checking the value of the global field.)

          • 2. Re: Find "All" Value List

                 Thanks Phil that worked perfectly. I have another similar scenario I could use some help on. That same field "ProjectStatus" is used again on another layout. In this situation I have three fields "g_SearchBrandStatus", "g_SearchProjectStatus" & "g_sortAssetStatus" each pulls from a different value list. When a value is changed in a field the results are updated based on the one that changed and the two other field values My current solution works perfectly but again I want to have the ability to select "All" for each of the three fields. Also each record will have a value in each field - none will ever be blank.

                 All three drop down fields use the same trigger script which is shown in the pict.

            • 3. Re: Find "All" Value List

                   Use the "red" option in my original post. If the "all" is specified for a given field, put an asterisk in the field, if not, set the contents of the global search field.

                   You'll just need three lines of code instead of one, 1 for each field.

              • 4. Re: Find "All" Value List

                     Thanks again Phil worked perfectly! I'm learning!

                • 5. Re: Find "All" Value List

                       This is working perfectly Phil. I have 3 separate scripts, one for each field. Is it possible to create one script that would work for all three fields? Attached are the three scripts I created.

                  • 6. Re: Find "All" Value List

                         Yes, but the details depend on the results that you want when you specify multiple criteria.

                         Do you want records that match criterion 1 OR criterion 2 OR criterion 3?

                         or do you wnat records that match criterion 1 AND criterion 2 AND criterion 3?

                         With the second option, you will put 3 If blocks one after the other between Enter Find Mode and set error capture.

                         With the first option, you must use new Record/Request to create a new request for each criterion.

                         You'll also need to handle a third option for each of the three fields--what to do if no value is selected in that particular global field.