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

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

Recommended Posts

Posted

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

Posted

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

Posted

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.

Posted

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

Posted

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.

Posted

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.

This topic is 7540 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.