AnsweredAssumed Answered

Recursive Custom Function Returns "?"

Question asked by StevenBrown on Feb 7, 2013
Latest reply on Feb 8, 2013 by philmodjunk

Title

Recursive Custom Function Returns "?"

Post

     Hi all,

     I am writing a FileMaker custom function that determines if a word exists in a value list. Some elements in the list match with a trailing wildcard character ("*"), whereas others are exact matches. The function is returning a "?" but I cannot determine why. Any help is greatly appreciated!

      

// Function takes two parameters: word and dictList (value list of words)
Let (
[
     libRawWord = Substitute(LeftValues( dictList ; 1); "¶" ; "");
                libRawWord = Substitute(LibRawWord; " "; "");
     isWildCard = Right( libRawWord ; 1 ) = "*";
     libRefWord =
          Case
          (
               isWildCard ; Left ( libRawWord; Length(libRawWord)-1 ) ;
               libRawWord
          );
     isMatch = Case( isWildCard ; Position(word ; libRefWord ; 1 ; 1) = 1 ;
                                          Exact( libRefWord ; word) = 1);
     dictList = RightValues ( dictList ; ValueCount(dictList) - 1 )
];
     Case
     (
          isMatch ; True ; // Should be true, just testing...
          not IsEmpty(dictList) ; IsMatchedWord( word ; dictList );
          False
     )
)

      


     Interestingly, if I change the definition of isMatch to Position(word ; dictList ; 1 ; 1) = 1, the code executes without a problem (although not with the functionality I want).

Outcomes