Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Bug with Replace Contents

Featured Replies

I am not sure if I am seeing a bug with the new Replace contents command or if I am just doing something wrong.

I am trying to replace a date in a master table with the max of the dates in a related table. Using the replace contents function either from the menu or in a script results in a number being entered into the field, it looks like a Julian date or some other internal representation used by FM7. Trying this with the Set Field command works fine.

I have attached a sample file. What am I missing?

Echo

Version: v7.x

Platform: Windows XP

TestDB.zip

I can verify that this happens on OS X as well.... I created a calc field with a date result in the main table with the same formula and that field has a date format. If I replace the contents of the portal fields with that field, the problem does not occur.

I have attached the modified file

TestDB-1.fp7.zip

  • Author

I see the same thing in WinXP. Basically it appears that the max function is returning the correct result in the correct field format, but when it is used in conjunction with the Replace command, the Replace command does not enter the data into the field in the correct format.

How about trying...

GetAsDate ( Max ( RelatedTable::Dates ) )

...when using the Replace Records feature. That should do what you are looking for.

SR

FileMaker Version: Dev 7

Platform: Windows XP

GetAsDate ( max(relatedTable::Date) )

Will work. The problem is FM starts counting dates from some arbitrary date and up. So it seems it still stores dates as numbers, and Max() is a numerical function. Not a date function. So it's going to return the numerical value of the date.

  • Author

GetAsDate works just fine. Thanks.

I believe that the max function is more than just a simple numerical function. It is supposed to accept many different data types, and return the same type as it's input parameters. It works just fine when used with a Set Field calculation, but not the Replace calculation.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.