5 Replies Latest reply on May 31, 2017 6:59 AM by beverly

    Configuring a custom function


      Hello Filemaker users,


      I am trying to use a cf from briandunning.com ( FileMaker Custom Function:RemoveDuplicates ( Text )  ). I have created three parameters, which are: "text", "RemoveDuplicates", "TheValue".


      But I still get the following error: An operator (e.g. +,-,*,...) is expected here. I have attached a screenshot with a specific position marked yellow. Can somebody explain me how to solve this?

      Kind regards,



        • 1. Re: Configuring a custom function

          The custom function is named "RemoveDuplicates" but you have named it "RemoveDuplicatesInText".


          Since this is a recursive function (it calls itself), you either have to keep the original name or change all references to the function to the new name.


          Notice the usage of the original "RemoveDuplicates" name to the left of the yellow highlight in your screen shot.  Notice that you have defined a different name for the function at the top of the screenshot.



          1 of 1 people found this helpful
          • 2. Re: Configuring a custom function

            You have a second issue going on.


            You have added two extra arguments to the RemoveDuplicates function definition.  Both of which use names that are otherwise used by the function.  The only argument to the custom function is "Text".  Remove the other two from the custom function definition.


            The variable "TheValue" is created internally by the function.  The name "RemoveDuplicates" is the function name, and thus using it is an argument to the function is likely providing another reason why the function wouldn't work as expected.



            1 of 1 people found this helpful
            • 3. Re: Configuring a custom function

              The custom function you are attempting to use is mostly the same as the new UniqueValues() function built into FileMaker Pro 16.


              The FM16 function is not case-sensitive (i.e. "dog" is the same as "DOG" so only one will be in the final list).


              The FM16 function gives the correct result when your values contain a "|" character.  The RemoveDuplicates() custom function you are attempting to use will not give the correct result for the two-item list:




              It incorrectly gives:




              And it appends a line break ("¶") to the original list when one was not present.


              If you want to use a custom function, I recommend using UniqueList() from Agnès Barouh.  This uses the very useful CustomList() from the same author which you'll need to define first.  UniqueList() is limited to about 18000 values and can be case-sensitive or insensitive depending on the value of its second argument 1 or 0.  The order of the values in the list are preserved (keeps only the first instance of the value).  It does not add an extra "¶" to the list.


              A simpler alternative is UniqueValues() from Jeroen Aarts.  It is similar to RemoveDuplicates() custom function in that it is self-contained with no extra custom functions needed.  It is always case-insensitive.  It adds an extra "¶" to the end of list when the original list does not have one.  It does not preserve the order of the values.



              2 of 2 people found this helpful
              • 4. Re: Configuring a custom function

                Thank you for your detailed reply! I have Filemaker 16 and I will try the uniqueValues() functionality.

                • 5. Re: Configuring a custom function

                  After testing, you might have an explanation of what you did to fix the problem. Mark your final comment at correct or mark Tom's answer as correct so others may know.