4 Replies Latest reply on May 16, 2013 9:29 AM by BruceRobertson

    Value list from another file is not working

    tadzyh

      Hi,

       

      In FM12 I have 2 files: F1, F2.

       

      In F1 I define a table and a value list as selecting 1st and 2nd fields from the table and only selecting related values starting from a TO of a table in F1 as well. When I display the value list in F1 I can see all the values I expect however if I try to access the value list from F2 I get an error <unrelated table>. If I remove the context from the value list I can view its values within F2.

       

      Does anyone have any clues how to fix this problem?

        • 1. Re: Value list from another file is not working
          Mike_Mitchell

          The error gives you the clue.    

           

          This issue has to do with the concept of "context". When you define a value list as "related values only", you're telling FileMaker you want it to display the values in table B from the perspective of table A, based on the relationship between them. If you try to view that value list from any other context (i.e., from a table occurrence / layout where the relationship can't be resolved), it'll tell you, "Sorry, I can't resolve what the relationship ought to be, so I can't figure out what the list of values ought to be."

           

          There are a couple of ways around it:

           

          1) Depending on your data model, you could add table occurrences to file 2 that match the table occurrences in file 1 and use the value list that way. This will work if the layout you want to use the value list on will properly match the relationship.

           

          2) You can use ExecuteSQL ( ) to populate a field with the values you want, then base the value list on that.

           

          3) There are some snazzy methods for using ExecuteSQL to populate the value list directly, too, if you'd rather do that.

           

          HTH

           

          Mike

          • 2. Re: Value list from another file is not working
            tadzyh

            Thanks Mike,

             

            I thought that might be the only solution - in fact I had resolved it by  defining the relationships within F2 and no longer use the value list from another file.

             

            Essentially what it says is that value list from another file only works when you have defined the relationships within the calling file - it's picking up the definition in F1 and trying to resolve it within the context of F2 rather than using F1 to work out the values and serving the values to F2.

             

            The documentation wasn't very clear on this subject  and, in fact it doesn't seem even worth having this feature since you have to do all the work to define the TO's and relationships within your using file anyway you might as well define the value list in that file as well.

             

            Zoe

            • 3. Re: Value list from another file is not working
              Mike_Mitchell

              The "use from another file" feature is very old; it predates the "defined based on a relationship" feature. In fact, it's quite useful in many circumstances, especially in cases where you had hard-coded value lists (which are mostly obsolete nowadays, but you know ... ).   

               

               

               

              Sent from my iPad

              • 4. Re: Value list from another file is not working
                BruceRobertson

                Well, hard coded values lists are the only practical way to achieve custom ordering of the items.