4 Replies Latest reply on Dec 9, 2010 8:39 AM by philmodjunk

    ValueListItems

    ThomasNL

      Title

      ValueListItems

      Post

      I have a lot of valuelists in separated interface and data files in one combined api.

      I need to extract the items in a certain valuelist to make a diagram, I have tried to get this through the ValueListItems(database;valuelist) but it does not produce any content, not when I make a calculation field, nor when I use a variable in a script. All stay empty. Strange thing is ValueListItems ( filename ; valuelist ) needs a TOC name and not the filename (is not accepted in the function).

      The only accepted text is ValueListItems ( Werkkaart::herkomst werk ; Werkkaart::herkomst werk ) where Werkkaart is toc in the file the first is the toc and field, the second the toc and the valuelist. If I only fill in first “Werkkaart” it says “table? Not found. And when I fill in only the valuelist name I get the samen message. But it does not require a table as it says filename and valuelist; very confusing.

      What AM I not seeing? Has any one had a similar problem or knows what to do?

      valuelist.jpg

        • 1. Re: ValueListItems
          philmodjunk

          You need some quotes here to get what you need. Correct syntax if you type in the name of your file is:

          ValueListItems ( "FileNameinquotes" ; "ValueListNameinQuotes" )

          If this function call is used in the same file where you have defined the value list, it's better to use:

          ValueListItems ( Get ( FileName ) ; "ValueListNameinQuotes" )

          As this will allow this function to work correctly even if you change the name of your file.

          • 2. Re: ValueListItems
            ThomasNL

            I did do the first already, which was accepted but the second syntax were I substituted “inQuotes“ with the correct name of the valuelist, said “field not found”?

            • 3. Re: ValueListItems
              ThomasNL

              Sorry, just seen the light. I have to put it in between quotation marks. Thanks you.

              But why is this not mentioned in all the handbooks and training series I have?

              • 4. Re: ValueListItems
                philmodjunk

                If it is in quotes, you will not get "field not found"

                FileMaker is attempting to evaluate each parameter as an expression. If you put the names in quotes, the quotes keep them from being evaluated. If you leave out the quotes, filemaker attempts to evaluate them and thus will attempt to treat the text you entered as a table and field name combination. When no such table name is found, you get that error message. The value list name must be enclosed in quotes unless you are using a field to refer to the value list name indirectly.

                If I have a file named TestFile.fp7 and a value list defined in it named Fruit when I look at it in Manage | Value Lists... I can use ValueListItems like this:

                ValueListItems ( "TestFile" ; "Fruit" )

                If I omit either set of quotation marks, I'll get the error you describe. If the quoted text does not match the name of a file or value list, I get an empty list returned by this function.