Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

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

Recommended Posts

Posted

The data I am working with is formatted as yyyymmmdd

I assume I need to use the currentdate function, however when I ask for current date it gives some number that is not formatted same way. I would like this to work so I don't have to change it again.

Thanks

Posted

Is it a text or date field? If it is a date field, create a calculation field with:

Date( Month(x), Day(x), Year(x) )

where x is the field name.

If it is a text field, try a calc field with:

Date( Middle( x, 5, 2 ), Right( x, 2 ), Left( x, 4 ) )

Either will produce a date result that you can then use with other date functions such as the current date one.

Posted

Perhaps you'll have some use for this. i`m using it myself and it gives the age in years/months/days. Maybe this age is to detailed for you but look at the code and change it to your needs. By the way there are plenty of these code on the internet (copy paste).

AGE.fp7.zip

Posted

They are merely text functions to extract the leftmost (for the year), rightmost (for the day), or middle (for the month) characters to put into the Date function.

Are you saying that it is a date field with data entered as yyyymmdd or that it is merely formatted that way on the layout?

Posted

The data is entered as yyyymmdd into FileMaker? I didn't even know that was possible.

Well, in that case, I may have given you unnecessary information. Perhaps if you explicitly state what your goal is and what you are working with, we'll be able to help more.

Posted

I suspect the data was imported as text into a date field, where it is now stored as invalid dates. To make sure, I would search the field with a question mark.

Posted

I didn't even know that was possible.

I believe if it is an import, FM can't stop it but it will come up as invalid if searched for ? and if modified, FM will squawk.

Posted

Ah, what if one changed the field type to text and created a date field with the above calculation? Seems like it would resolve the importing issue.

Posted (edited)

Yes. One can't apply Set Field [] directly against the date field. I believe another field would need to be used to correct it.

God, it's good to have you back. :wink2:

Edited by Guest
Posted

One can't apply Set Field [] directly against the date field

Why not? It may be preferable to do it the way JT suggested (since it's reversible), but it's not a must.

Posted

No, once you have imported a new set of records, just run a Set Field loop to convert the date value appropriately. Since I don't know the specific script steps in FM 8, I'll use pseudo-code.

Go to Record [First]

Loop

Set Field [datefield; Date( Middle( datefield, 5, 2 ), Right( datefield, 2 ), Left( datefield, 4 ) )]

Go to Record [Next; Exit after last]

End Loop

For the existing records, run a Replace Field Contents in the date field with the calculation above.

This will convert all the invalid dates into a valid date format.

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