5 Replies Latest reply on Apr 2, 2013 12:55 AM by Fred(CH)

    Patterncount() function fails to detect match when looking at UUID value

    BruceHerbach

      Summary

      Patterncount() function fails to detect match when looking at UUID value

      Product

      FileMaker Pro

      Version

      FileMaker Pro Advanced 12.0v3

      Operating system version

      Mac OS X 10.8.2

      Description of the issue

      Running a script to create related records. Using the Patterncount function to determine if a record has been created.  It fails to detect a match when the - character is part of the UUID.

      Steps to reproduce the problem

      This is in a script.



      Set Variable[$IDlst; List($IDlst; table::ID)]
      .
      .
      .
      if[patterncount($IDlst; $newID) = 0]
        new record
        set field...
      end if

      Expected result

      When value in $IDlst = $newID script steps below if are skipped.

      Actual result

      patterncount fails to detect match and returns 0.  New record is created.

      Exact text of any error message(s) that appear

      None

      Workaround

      Use Substitute function to remove the - character from the variable and the value to be compared.  This results in the script working correctly.

      Set Variable[$IDlst; List($IDlst; substitute(table::ID; "-'; ""))]
      .
      .
      if[patterncount($IDlst; substitute($newID; "-"; "")) = 0]
        new record
        set field...
      end if

        • 1. Re: Patterncount() function fails to detect match when looking at UUID value
          BruceHerbach

               Please cancel this report.  Went back into script removed all of the Substitute functions and tested again..  Now it works correctly putting in only one new record per ID.  I can't explain original failure at this point and can't reprodude the problem.

          • 2. Re: Patterncount() function fails to detect match when looking at UUID value
            philmodjunk

                 Hmmm, one possibility is that if you are using one of the "values" functions in your calcualtions, you may be getting an extra return character that you didn't expect and this would keep two values that appear equal from evaluating as equal when compared due to the invisible return character.

                 Rightvalues, LeftValues, Middlevalues, FilterValues all return values with an extra return character after the last value in the list.

                 I would really like to hear the FileMaker programmer who made that design decision explain why they did as I get real tired of complicating my calculations with code that strips out that extra return...

            • 3. Re: Patterncount() function fails to detect match when looking at UUID value
              Fred(CH)
              Phil, can we take a little bet until the engineer's answer ? I was wondering the same thing and then i found my own answer : This principle was certainly established to simplify theses function's aggregation. In your calculation,  when you add a LeftValue with a MiddleValue with another LeftValue with a etc..., it is more easy and reliable to remove only the last char at the end of the calculation, than add a carriage return between each calls, in particular because they can be empty (and then, as you know, you must test it at each call to no distort the results with a lot of extra returns). These functions are well designed because when you have any value to get, the result of theses functions is empty and not just one return character... well, It is just my opinion... Bye, Fred PS: Excuse me for my bad english. PPS@Oracle : Please return my carriages returns to me, gosh !
              • 4. Re: Patterncount() function fails to detect match when looking at UUID value
                philmodjunk

                     I disagree. It's easier to add a return than to remove it.

                     List ( sublist1 ; Sublist2 )

                     or

                     Sublist1 & ¶ & sublist2

                     are simple ways to combine sublists where there isn't a trailing return.

                     LeftValues ( ListExpression ; Length(List Expression) - 1 )

                     just to stip off a return that I don't want. isn't nearly so simple.

                • 5. Re: Patterncount() function fails to detect match when looking at UUID value
                  Fred(CH)
                   Hi Phil, Thank you for your explanation. I didn't considered  the List function. By this way, you have right, it is clearly easier. Can i disagree myself ? ;-) Bye, Fred