Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

FM bug with ValueListItems() function ??


This topic is 3063 days old. Please don't post here. Open a new topic instead.

Recommended Posts

There appears to be a bug in FM9 (and probably prior) with the ValueListItems() function. If you pass a filename in the first parameter that contains a period, the function returns nothing. That is, if the actual name of the FM file on disk has a period in it (such as a file extention), then the ValueListItems function return "".

So.. if my filename is 'FMProDB' everything is fine. If it is 'FMProDB 1.0v1' the function fails.

This happens regardless of whether the first parameter is passed as a string literal (i.e. "MyDabase.fm7") or by using the Get(Filename) function as follows:

ValueListItems ( Get ( FileName ) ; "colors" )

I'm wondering if someone can verify this as a FM9 bug or not. I have only tested on Mac and would like to know if it also fails on Windows. Just create an empty database with a value list of custom values (i.e. colors, etc). Then use the Custom dialog script command (with the above line of code) to display the contents of the list. It will work if the filename has no period. It will fail if it does.

John

Link to comment
Share on other sites

On Windows, I can confirm that, if file is Colors.v1.fp7 and I have value list called Colors and custom dialog is: ValueListItems ( Get ( FileName ) ; "Colors" ) ... that it does not work - it is blank. If I remove the period before v1, it works and lists the values.

UPDATE: Whether it is a bug or not ... I've always been taught never to have a period within name because the dot separates the file name from the extension. I suppose that's why most people wouldn't have noticed this oddity.

Edited by Guest
Added update
Link to comment
Share on other sites

This is a known issue. It affects not only the ValueListItems() function, but any function that requires the file name. The solution is to include the file extension explicitly in the file name. This works even if you use Get (FileName) to return the file name dynamically:

ValueListItems ( Get ( FileName ) & ".fp7" ; "MyValueList" )

Of course, this is not required if you take care not to use period when naming your files.

This happens regardless of whether the first parameter is passed as a string literal (i.e. "MyDabase.fm7")

That is not my experience - maybe because I use the correct extension which is ".fp7"?

Link to comment
Share on other sites

Thanks much for the .fp7 trick. That works fine.

But.. the bottom line is that this is a bug. If it is possible for an end user to completely hose your app by simply renaming the database file with a valid Finder or Windows Explorer name, something is wrong. Both Win and Mac handle a period in the name just fine -- even including the extention period.

Also.. if a period in the file name was invalid, then many other things in FM would break that do not such as relationships across multiple files, lookups across multiple files, etc.

They need to fix this.

Link to comment
Share on other sites

  • 2 years later...

The problem is the period in the file name. Known issue. Adopt a file naming convention that does not allow periods. Problem solved.

Link to comment
Share on other sites

  • 5 years later...
On April 20, 2011 at 6:57 PM, Vaughan said:

The problem is the period in the file name. Known issue. Adopt a file naming convention that does not allow periods. Problem solved.

Here is the bug report and discussion on this long-standing FileMaker bug. 

https://community.filemaker.com/thread/133594

Please don't say "problem solved" when there is a bug that prevents people from doing very typical work behavior. Mac and Windows both allow non-file-extension-preceding periods/dots in file name, and most apps work properly, unless that app has a bug. Users should be able to rename files, unless you are saying FileMaker should only be used in very controlled corporate environments. In that case, FileMaker Inc. will need to adjust their priorities in what features they push, right? ;-) 

Link to comment
Share on other sites

Developer Utilities is the only safe method of changing file names by changing all file references at same time.

As for ValueListItems() and if referencing local file, this works:

ValueListItems ( "" ; "your value list name" )

By not specifying the file name, FileMaker assumes it is the local file so you can safely rename the file.  That does not protect from multi-file solutions however.

I should add ... even if you only have a single file, renaming the file can break import scripts referencing the same file.  Nowadays, we set variables with the path and use it instead but before variables, imports were easily broken.

Link to comment
Share on other sites

I don't think so.  I read it somewhere in a blog late one night and haven't been able to find it since.  :tongue2:

I tested it and it does work for many functions in versions 12 and up.

I haven't tried versions prior to 12.

Link to comment
Share on other sites

This topic is 3063 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.