1 2 Previous Next 17 Replies Latest reply on Nov 22, 2016 3:55 AM by beverly

    Design functions fail when filename has a dot in it

    danshockley

      Summary

      Design functions fail when filename has a dot in it

      Product

      FileMaker Pro

      Version

      11, 12 (plus others?)

      Operating system version

      Mac OS X 10.8.3, iOS 6 (actually, any OS, though not tested on Windows)

      Description of the issue

      The Design functions (TableNames, TableIDs, LayoutNames, LayoutIDs, etc) fail when the file in question has a dot in its name. This is true for FileMaker 11, and continues to be a problem in FileMaker Pro 12 and FileMaker Go 12.
      What seems to be happening is that those functions assume that whatever comes after the last dot in the "filename" parameter MUST be an extension and should thus be stripped off. This is the opposite behavior of what is returned by the Get ( FileName ) function, which is the name without the file extension. In other words, despite the fact that the parameter is labeled "filename," you MUST include some kind of (even completely false) file extension to avoid this bug.
      When a file does not have an extra dot in its name, you can do the following to get a list of the layout names in a file:
      LayoutNames ( Get ( FileName ) )
      But, the same expression returns nothing when the file has a dot in its name before the one preceding the file extension.

      Steps to reproduce the problem

      1. Have a file named, for example, SomeFile.fmp12  (or SomeFile.fp7 if in versions before 12).
      2. Open Data Viewer's "Watch" tab, add a new expression, and type in: LayoutNames ( Get ( FileName ) ), then click the "Monitor" button.
      3. See that it provides a return-delimited list of the layout names in that file.
      4. Close the file and rename it, for example, SomeFile.23.fmp12, then open it back up.
      5. Look at what and notice that the expression entered before now returns nothing.
      6. Modify the expression to: LayoutNames ( Get ( FileName ) & ".random_text" )
      7. It works again, despite the fact that the value provided for the 'filename' parameter is ridiculous.

      Expected result

      The filename parameter should accept the same thing that the Get ( FileName ) function returns: the filename without a file extension. At the very least, it should attempt to use the filename provided AS-IS before stripping off whatever comes after a dot in the name. That should be a fall-back operation, not the default.

      Actual result

      The Design functions throw away the part of the file name after a dot, assuming anything after it is a file extension, and fail to provide the objects requested.

      Exact text of any error message(s) that appear

      N/A

      Workaround

      Throw on any file extension to the parameter, regardless of whether it is the real file extension or not. The important thing is to have something that is NOT the filename come after the final dot in the value submitted to the function.

        • 1. Re: Design functions fail when filename has a dot in it
          danshockley

          Follow-up on this:

          First, just to clarify, in the description above, it should say that those functions fail when the filename has a dot in its name OTHER THAN the dot preceding the file extension. See the Step to Reproduce the Problem for an example.

          Second, this bug remains in both FileMaker 13 and in FileMaker 14, running in Mac OS X 10.10.3 Yosemite. The Workaround still works, but is nonsensical. The Design functions should not naively assume that anything after a dot is the file extension and ignore it, causing them to fail. They should work consistently with what the Get ( FileName ) function returns, not requiring us to append a garbage fake extension.

          • 2. Re: Design functions fail when filename has a dot in it
            Benjamin Fehr

            There are some general recommendations about name conventions. Using dots other than for suffix separation can cause trouble any ways with FMP as well as within the Mac OS!

            Avoid any special characters (#*Ω) AND use _ (underline) instead of space " ". Replacing space with underline makes sure you can select a item with simple double-click since there isn't any "break" within the name.

            • 3. Re: Design functions fail when filename has a dot in it
              user14047

              FileMaker Pro Help : Design functions

              Notes
              If you specify a filename as a parameter and the filename contains a period, include the filename extension in the parameter. Otherwise, functions may interpret the period in the filename as the beginning of the filename extension, which can lead to unexpected results.
              2 of 2 people found this helpful
              • 4. Re: Design functions fail when filename has a dot in it
                user19752

                Hmm, I don't need dot in filename myself, but this seems misdesign of function...

                As danshockley mentioned, Get(FileName) don't contain extention, so DesignFunction ( Get(FileName) ) should know there is no extention in parameter.

                Or, this may be root of probleme, why Get(FileName) remove extention from filename? Is there any function getting extention?

                • 6. Re: Design functions fail when filename has a dot in it
                  danshockley

                  I avoid using special characters in filenames, but using dots should not have ever been considered unusual or special. That said, it is clearly something FileMaker doesn't handle properly, so I avoid it for FileMaker. I'm just pointing out that this is a bug, whether it happens in FileMaker or in Mac OS X, or any other operating system. The dot is NOT a reserved character meant only to indicate an impending file extension, although the final dot strongly implies that what follows is a file extension.

                  In the other thread that Fred linked to, there is advice from FileMaker to not use more than one dot in a file name for hosted databases, but the issue described here happens even on local databases, so that advice must be addressing some Server-specific issues.

                  Just as an example of when someone might want to use dots in a file name: Let's say you have multiple versions of a database locally, and you are trying to use FileMaker to compare them. You might name those files:

                  • MyFile_1.0.fmp12
                  • MyFile_1.1.fmp12
                  • MyFile_1.2.fmp12

                  Then, you might reasonably want to compare, for example, which layouts are present in which file. You would do that using the LayoutNames or LayoutIDs Design functions. That would fail. That is the bug this thread is addressing.

                  FileMaker does not give advice to avoid using a dot anywhere in a database name other than preceding the file extension. Perhaps they should give that advice if they officially decide that a dot is a reserved character. In the decades FileMaker has been available, they have not publicly made that decision (although this issue has been around for at least ten years, probably more).

                  So, I'm accepting that the example I gave above should use some other naming convention, since FileMaker's actions (or lack thereof) have strongly implied they don't think anyone should use a dot for anything other than a file extension. But, without official word that this is a deliberate design decision, I think it is fair to call it a long-standing bug, with avoidance being the work-around.

                  • 7. Re: Design functions fail when filename has a dot in it
                    danshockley

                    I just noticed user14047's comment, so I guess I need to retract the part where I said this isn't documented, at least partially. I still view this as a bug, but at least there is some acknowledgment that FileMaker doesn't handle this gracefully.

                    • 8. Re: Design functions fail when filename has a dot in it
                      danshockley

                      It seems like the common problem of not calling things what they are. Is the file extension part of the file name, or not? This distinction is inconsistently made, and not just in FileMaker. We can thank operating systems that don't have the classic Mac OS meta-data storage for this problem. But, that ship has sailed.

                      I think Get ( FileName ) avoids returning the file extension because that helps avoid problems moving to a new file format (think ".fp7" versus ".fmp12").

                      A fix that might help quite a bit would be for the Design functions to see FIRST if there is a file whose file-base-name (without extension) matches the specified parameter, and only if there is NOT, to strip off the substring that comes after the dot. The strange reality is that the Design function doesn't care what you put after the dot. If you have a database open named "MyFile.fmp12" and try this: LayoutNames ( "MyFile.FAKE" ), it will return the layout names.

                      • 9. Re: Design functions fail when filename has a dot in it
                        RalphLearmont

                        I am still using Filemaker 11.0v4 from time to time and checked to see if the problem existed there.  It doesn't - it wasn't a problem back then.  Also checked Filemaker 11 Help, and there's no mention of this bug.

                         

                        In version 12 and 13, I notice the bug appears for the first time. On checking their Help, there's no mention of the problem.  It appears the cautionary note has only been mentioned in Filemaker 14 Help.

                        • 10. Re: Design functions fail when filename has a dot in it
                          danshockley

                          No, this bug also existed in FileMaker Pro 11. I just followed my "Steps to reproduce the problem" exactly. As described, it failed on step #5, returning no layout names. However, one difference in the bug behavior is that step #6 (adding nonsense to make it "work" again) still fails unless the nonsense extension is 4 characters or fewer. So, to demonstrate the bogus "work-around" for FileMaker 11, modify step #6 to:

                           

                          6. Modify the expression to: LayoutNames ( Get ( FileName ) & ".blah" )


                          (where blah could be any string of 1 to 4 characters, including numbers).

                           

                          This bug persists in FileMaker 13 and 14 - I just tested it, following the steps I described originally.

                          • 11. Re: Design functions fail when filename has a dot in it
                            danshockley

                            That is great advice for FileMaker to provide, if you are hard-coding the filename. But, if you are using design functions as they are intended to be used, the Get ( FileName ) function doesn't honor that advice.

                             

                            So, I suppose a work-around would be something like this: make a custom function named "GetActualFileName" that returns the entire file name (extracting it from Get ( FilePath ) ), not just the non-file-extension portion of the file name. Then, you would have to know to use THAT custom function whenever you call a Design function, instead of the built-in function that FileMaker provides.

                             

                            I just find it frustrating that the parameter specified for Design functions is FileName and FileMaker's documentation says that the function Get ( FileName ) returns a file name. This bug demonstrates that FileName means two different things in the documentation, without indicating that difference. This is similar to the issue of what TableName means in various functions. Sometimes it means table occurrence name, and sometimes it means base table name, and behavior is silently affected by that distinction, without being clearly documented.

                            • 12. Re: Design functions fail when filename has a dot in it
                              danshockley

                              I think the fix would be for the Design functions to first attempt using the file name, as specified, to get whatever design features the function returns. If no file with that non-file-extension-name exists, THEN strip off the portion after the last period and try that.

                              • 13. Re: Design functions fail when filename has a dot in it
                                danshockley

                                Bug persists in FileMaker 15.0.1.119 on Mac. Have not tested in Windows.

                                • 14. Re: Design functions fail when filename has a dot in it
                                  LaRettaK

                                  One thing you can do until it is fixed ...

                                   

                                  ValueListItems ( "" ; "your value list name )

                                   

                                  By not specifying the file name, FileMaker assumes it is the local file. 

                                  1 of 1 people found this helpful
                                  1 2 Previous Next