August 17, 20187 yr I am updating a database where the legacy solution has separate Fields for Date and Time, which were set via "auto enter" options. In the new solution I'm thinking perhaps I should replace them with a single "Timestamp" field, but wondering whether there are reasons not to . . . so 1) Can I simply concatenate the legacy data in the two fields for the existing records, with a space between them? Will they "behave" like the fresh records where the full timestamp is auto-entered? 2) Is there a way to display *only* the date, or *only* the time when placing a 'Timestamp' field on a layout? I'm not seeing a way to do this . . . so is it best to just have separate fields if you might want to 'suppress' one or the other in a given display? thanks! Edited August 17, 20187 yr by Wickerman
August 17, 20187 yr 2 is easier. You can display a button bar, 2 buttons, that look like the fields with these calculations (one per button): GetAsDate(Table::Timestampfield) //shows only the date portion of a timestamp GetAsTime(Table::Timestampfield)//shows only time. 1. I would think you could write a script that concatenates. The date field & " " time field, placed in a timestamp field would work. Depends on how precise you need it. Timestamp would be better
August 17, 20187 yr Author Thanks very much! yeah, I'm thinking it's probably just as easy to keep two fields after all . . . But with regard to the concatenation, I'm still a little fuzzy. What I'm envisioning is once I've imported the records I create a separate, new TimeStamp field, which will then be empty for all current records. I would just "Show all records" and then do a "Replace field Contents" for the Timestamp field, using the concatenation you describe as the Calc. Then going forward, the Timestamp is auto-entering and we're all set, and I can delete those separate legacy fields. So . . . if I did that, would there be any way of telling the difference between the legacy data that I concatenated and the auto-entered entries for new records? I'm hoping there would be no difference. I think if there were any difference at all, I wouldn't want to do this . . .
August 18, 20187 yr I can't test this but I would first make the timestamp an unstored calculation field with timestamp as the calculation result. It will make your timestamps for you. Then change it to a timestamp field, either creation or modification. After that all new records would get a proper timestamp Edit: The above won't work. What you recommended will work First, try on backup copy of file. Make a timestamp field, no options (modification, creation, auto enter). Then go to your records, make sure all timestamp fields are empty and use Replace Field Contents with the calculation: Table::DateField & " " & Table::TimeField Then your timestamp field looks like it should. Then go back into Manage Database and change your timestamp field with the proper auto enter option (creation/modification). Edited August 18, 20187 yr by Steve Martino initial wrong info.
Create an account or sign in to comment