1 2 Previous Next 25 Replies Latest reply on Nov 2, 2014 1:02 PM by tays01s

    Conditional value lists

    tays01s

      Title

      Conditional value lists

      Post

      I have a 'Patient' table/layout with a pop listing names. I'd like to make this list conditional to:

      a) In use/ filed [radio-button, Patient::PatientStatusList] &

      b) Location [pop-up based on a value list, Patient::Unit].

      Because of other parts of the BD I'd like to achieve a conditional value list for Patient::Names based on a TO of the Patients table. However, when I try relating:

      - Patient::PatientStatusList > Patient2::PatientStatusList &

      - Patient::Location > Patient2::Location.

      However, there is no change in the pop-up Name list when I change either PatientStatusList or Location. I should mention that

      - PatientStatusList: Value is updated using Patient::PatientStatus radio button &

      - Location: Value is updated using Patient::Unit drop-down.

      Both the above settings correctly update their respective settings.

        • 1. Re: Conditional value lists
          philmodjunk

          I am assuming that you are trying to set up this relationship:

          Patient::PatientStatusList = Patient2::PatientStatusList AND
          Patient::Location = Patient2::Location

          I'm not sure that will do what you want, however.

          If you then set up a Use Values From Field value list to list values from Patient2 and select "Include only related values starting from Patient". You could set up a value list on a Patient layout and get a list of all patients with the same status and from the same location. Note that "in use/Filed" and Unit have no effect on the function of this relationship.

          You may find it useful to review the 8 different approaches to setting up a Conditional value list demonstrated in "Adventures in FileMaking #1 - Conditional Value Lists". The file is a free download.

          Caulkins Consulting, Home of Adventures In FileMaking

          • 2. Re: Conditional value lists
            tays01s

            Yes my relationships are set up exactly as you describe and I've already selected: "Include only related values starting from Patient". However, when you say: You could set up a value list on a Patient layout and get a list of all patients with the same status and from the same location.......do you mean a value list of: 1st field: Patient 2:__ID showing only 2nd field: Patient 2:: Names getting only related record starting from Patient?

            If so, as you suspected, it doesn't work. Do you have pointers to what might be going wrong or a better approach?

            • 3. Re: Conditional value lists
              philmodjunk

              It should "work", provided that the fields in question are indexed and correctly match values and field types. But I questioned whether it will produce the list you want to see.

              I have already pointed you to a file that has detailed working examples of a number of different conditional value lists with detailed explanations of how they were set up and how they work.

              Can you explain in more detail exactly how you need this to work?

              • 4. Re: Conditional value lists
                tays01s

                The way I'd like it to work would be that by specifying both PatientStatusList and Location on the Patients layout, the Patient::Names pop-up lists would be restricted to only those names with that status and location.

                • 5. Re: Conditional value lists
                  philmodjunk

                  And what you describe should do that. If you are getting an empty value list or the wrong list of values, we'll need to take a closer look at the relationship details or the values in the match fields that should match but aren't matching.

                  • 6. Re: Conditional value lists
                    FilmUser

                    Should such a value list work in Find mode?

                    • 7. Re: Conditional value lists
                      tays01s

                      OK:

                      Relationships:

                      Patient::PatientStatusList >-<Patient 2::PatientStatusList

                      Patient::Location >-<Patient 2::Location

                      Value list

                      1st field Patient 2::ID showing only 2nd field Patient 2::Names

                      Here's where you shoot me!

                      The bit not mentioned because I didn't think it altered things was that the pop-up field using the value list is a global field, gSelectPatientID. The reason it's global is wanting records in all layouts to update to that patient. The script the pop-up activates script:

                      Perform Script [ “Allow user abort” ]
                      Enter Find Mode [ ]
                      Set Field [ Patient 2::__ID; Global::gSelectPatientID ]

                      Perform Find [ ]

                      However, since I changed from Patient to Patient 2, the script no longer updates all fields to the patient ID.

                      What does happen is that Use and File correctly reset the PatientStatusList field to In Use and Filed, respectively. However, if I reset to In use, I just get an ID number in the pop-up until I click outside the field and back in, then I get the name. If I then switch to Filed, I correctly get the remaining names on first click, but if I click again, the list even contains the name I just change to 'In Use'.

                      Pop-up: Yes it's set to work in both browse & find.

                      • 8. Re: Conditional value lists
                        philmodjunk

                        Conditional value lists can work in find mode. They can also fail. It depends on the design of your database.

                        Perform Script [ “Allow user abort” ]
                        Enter Find Mode [ ]
                        Set Field [ Patient 2::__ID; Global::gSelectPatientID ]
                        Perform Find [ ]

                        If your layout is based on Patient, the first parameter should use Patient, not patient 2. THis script does not update any fields, it finds records and that's something different. Using a global field should not affect how the conditional value list works.

                        What you are encountering is a commit records issue. Clicking outside the field commits the current record and this enables the relationships to update the conditional value list. You can use an OnobjectModify trigger on your field if it's a pop up menu, radio button or checkbox field to commit the record automatically. You may need to use OnObjectSave if this is a drop down list.

                        • 9. Re: Conditional value lists
                          tays01s

                          I've corrected the script back to using Patient, so that it correctly pulls up records.

                          Re. the problem that the value list did not appear to reflect the PatientStatusList choice (In-use or Filed), I think the calculation of this field may be at fault because after choose the alternate value (eg. filed) and 'in-use' record will become 'filed' again. Does this mean using this calculation causes all records to re-calc? And therefore should I instead use a script on PatientStatus radio-button to cause a change in the PatientStatusList? Current calc below:

                          Case(
                          Patient_status="Use" ; "In-use" ;
                          Patient_status="File" ; "Filed"
                          )

                          • 10. Re: Conditional value lists
                            philmodjunk

                            Changing the value in one field should have no effect on what values appear in the calculation fields of other fields unless:

                            a) the "one field" is a field with global storage specified

                            b) the "one field" is in a related table linked to many related records where a calculation refers to that "one field" in the same record.

                            But both of those options would tend to keep the field from being one that you can refer to in a "use values from field" value list as you normally need stored, indexed values in each. And which ever field is designated as the "sort" field in that value list, must in turn have unique values.

                            • 11. Re: Conditional value lists
                              tays01s

                              Can I share an fmp12 file, only 78kb and isolating this problem alone? I remember from a previous occasion that you don't find dropbox useful?

                              • 12. Re: Conditional value lists
                                philmodjunk

                                I do find drop box useful. Use it all the time. I just don't always have time to look at the actual file. (It's often the case that once I get the file, I then have to ask a lot of questions just to figure out where to look for the issue at hand so examining a file can take unexpected amounts of time. (I'm in the process of leaving one employer for another and so don't have as much time as previously for helping out in the forum.)

                                • 13. Re: Conditional value lists
                                  tays01s

                                  Understood. Best wishes in the new job.

                                  If a v. quick glimpse of the file is enough to spot the problem I've uploaded 'Temp.fmp12' to:

                                  https://www.dropbox.com/sh/d7by6qogstg3ymu/AAARwQRSmHQhPynYOJYOFrEAa?dl=0

                                  In short, I want Patient::StatusList & Patient::Location to set the Patient 2::Names and these be shown in the Patient::NameList pop-up. Seems simply but I've struggled with this for ages.

                                  • 14. Re: Conditional value lists
                                    philmodjunk

                                    It's not clear to me why NameList is from Patients2 on your layout, but two changes made things work:

                                    In the relationship between the two table occurrences, select "allow creation of records via this relationship" for Patients2. Without that change, you can't enter the field. But please note that selecting a value in this field can create a new record or modify an existing record. So the purpose to this field is not clear.

                                    In the status calculation field, change the result type from number to text. (Open up the calculation in the specify calculation dialog box to change.)

                                    1 2 Previous Next