March 31, 200421 yr 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
March 31, 200421 yr 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
March 31, 200421 yr 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.
April 2, 200421 yr 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
April 2, 200421 yr 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.
April 2, 200421 yr 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