Jump to content
Sign in to follow this  
Christensen Design

FM bug with ValueListItems() function ??

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

Share this post


Link to post
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

Share this post


Link to post
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"?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Of course it's a bug. But if you use more than one file in your solution (and these days who doesn't), it will still be possible for the end user to ruin it by renaming a file - even if this bug is fixed.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites
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? ;-) 

Share this post


Link to post
Share on other sites
1 hour ago, DanShockley said:

Users should be able to rename files

How would that work in a solution with more than one file?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
26 minutes ago, LaRetta said:

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

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

Is this documented anywhere?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

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