4 Replies Latest reply on Aug 19, 2010 2:52 AM by LaRetta_1

    Searching by dropdown list

    mayor

      Title

      Searching by dropdown list

      Post

      I got 2 tables called student & registration

      Student (name, studentID, address, status……..)

      Registration(reg_date, month_reg,  year_reg, study_level, studentID…….)

      Relationship field : studentID

      I intend to make searching method by using dropdown list.

      For example :

      Dropdown list for status (active, non-active, quit, extend)

      Dropdown list for reg_date(2009, 2010, 2011)

      I want to search students who is active in 2010.

      So, how to do that. This searching method I think more flexible compared to write a script for certain button.

      Please advice!

        • 1. Re: Searching by dropdown list
          LaRetta_1

          You will want two global fields: gRegYear and gStatus.  Create a value list for Status (File > Manage > Value Lists).  Use values from Field (specify all values below).  Create another value list for Reg_Date using values from your year field.  BTW, you should name that field yr and not date since it isn't a true date.  You could use custom value list but then you'd have to maintain it and add each new year - it is easier to let your data define your value list.

          Attach each value list to the appropriate global field as pop-up and place them in the header of your form.  Place a button next to these pop-ups and script would be (pseudo-script, always back up first):

          Freeze Window

          Go To Layout [ layout based upon Registration; suggest using a list view ]

          Enter Find Mode [ uncheck pause ]

          Set Field [ Student::Status ; gStatus ]

          Set Field [ Registration::Reg_Date ; gRegYr ]

          Set Error Capture [ On ]

          Perform Find [ ]

          If [ not Get ( FoundCount )  ]

          Show Custom Dialog [ "No records found" ]

          Go To Layout [ original layout ]

          Halt script

          End If

          ... if your script has reached this point it means you have found records

          ... since you are on the layout in Registrations where you want to be

          ... your script can end here or you can perform some other action on your newly acquired found set

          • 2. Re: Searching by dropdown list
            mayor

            Thanks VM LaRetta, it works.

            • 3. Re: Searching by dropdown list
              mayor

              I want to add 1 more searching criteria, for example mode_of_study

              Dropdown list for mode_of_study( research, mixed-mode, course-work)

              So, I created global field which is gmode_of_study and in the script I just add as below;

              Set Field [ Student::Status ; gStatus ]

              Set Field [ Registration::Reg_Date ; gRegYr ]

              Set Field [ Registration::mode_of_study ; gmode_of_study ]

              Is it true?

              But when I run the script, the new criteria added didn't read by computer. It seems there is no that criteria in the script. What I'm understand, we can add as much as criteria in the script, isn't it?

              Please advice me

              • 4. Re: Searching by dropdown list
                LaRetta_1

                Yes, it would work with the additional of more criteria, if the condition is AND ('in addition to' the other criteria entered).  Are you using FMPA (Advanced version with access to Debugger?  If not, add a pause script-step after the last Set Field[] and see what is displaying in those three fields.  If still stuck, I would suggest posting a copy of your script and, last resort, provide link to your file.