Newbies bob_trousers Posted March 3, 2005 Newbies Posted March 3, 2005 Hi, This is probably a simple one! I have 2 databases each with a field 'dateastext'. One is a global, and one isn't, but they are both Text format fields. In my script, I: Set Field[file1::dateastext;GetAsText ( Get ( CurrentDate ))] which in one file returns: 3/3/04 and in the other returns: 3/03/04 and as a result I cannot link the two files on the date field for a portal lookup! Do you clever chaps (and chappesses) know and way to standardise the return... TIA, Bob
-Queue- Posted March 3, 2005 Posted March 3, 2005 Have you tried just using Get(CurrentDate)? 7 is smart about converting it naturally.
Newbies bob_trousers Posted March 3, 2005 Author Newbies Posted March 3, 2005 Yes, just tried and it didnt work... Is there any locale (regional settings)information that can be modified in the actual database file itself? This is so frustrating! Thanks again, Bob
-Queue- Posted March 3, 2005 Posted March 3, 2005 I'm not certain what would cause this, but you could always use Right( "0" & Month(Get(CurrentDate)); 2 ) & Right( "0" & Day(Get(CurrentDate)); 2 ) & Year(Get(CurrentDate)) as your calculation.
comment Posted March 3, 2005 Posted March 3, 2005 You could also try cloning the files, to make sure they inherit the system's format. And/or in File Options.. Text, check Always use current system's settings. But truth to be said, relying on a date to text conversion is always iffy. Why not simply use the date as date, or as a number?
bikergeek Posted March 3, 2005 Posted March 3, 2005 Building on what Queue said, generally speaking you should make your relationships dependent on a calculation which formats consistently no matter what the system date or other input format is, such as by means of the calculation he includes. You can still use the text date field for other things, but by picking apart and reassembling via calculation the date, you can guarantee the required consistency.
Newbies bob_trousers Posted March 4, 2005 Author Newbies Posted March 4, 2005 Thank you all - the Right( "0" & Month(Get(CurrentDate)); 2 ) & Right( "0" & Day(Get(CurrentDate)); 2 ) & Year(Get(CurrentDate)) Code sorted it beautifully. I agree about the comments in using a unique number (but in my case there was a skills shortage in effecting this!) Much happier now.... Thanks again, Bob
Recommended Posts
This topic is 7272 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 accountSign in
Already have an account? Sign in here.
Sign In Now