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

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

Recommended Posts

Posted

I have Time fields that are currently set up to allow users to input the time as 1200. We use 2400 time format. Currently the time field is defined to leave data format as entered. I would like to go back and change all previously entered times to read 12:00. I would then change the time format of the field. I know I could setup a script and a loop to change all of the existing records. I was just wondering how I should create a calculation in the "set field" script step to accomplish this. Any input would be greatly appreiciated. Thanks, Ron.

Posted

Hi Ron,

You are using a time field now? Then I think FM is ahead of you. Time input is handled via field format (whether to use 12-hour, 24-hour or leave as entered). However, FM keeps track behind the scenes and internally tracks AM/PM properly.

If you change your field format time, it will convert automatically for you. FM is very forgiving on time fields. In other words, if Users type 1600 in a time field (with 'leave format as entered') and you change it to 12-hour notation with AM/PM, it will display 4:00 PM (or whatever you indicate in field format). Or are you saying you were using a text field? Because otherwise there is no need to do anything other than change the format. Am I missing your point here possibly? :wink2:

LaRetta

Posted

Hi Ron,

If you leave a time field (as you've indicated with 'leave data as entered' and a User types 1200, it displays 1200:00:00. So, to get field results of 1200, you had to have set the time format to specifically OMIT the ':'.?? Regardless, you now have a field with 1200:00:00. I would use calculations to test your results but this should work. Create a time calculation with:

Div(theTimeField ; 100)

If the User has typed 1400 and it produces 1400:00:00, the above calc will convert it to 14:00:00. Once you have verified you can get the results you wish, you don't need a script or to loop through your records at all. BACK UP FIRST and do this:

Go to your field definition on that time field. Change it from standard time field to calculation (result of TIME) and enter the above calc. Do not mess with Storage Options (don't make the calc unstored). Say OK to back clear out of field definitions. You will notice that time field has changed to 14:00:00.

Now go back into your field definition and change it back to a standard time field. The data will preserve the calculated reformat. This is a quick way to correct data by using FM instead of running a script. It is faster than Replace Contents, looping scripts and other such nonsense. :wink2:

LaRetta

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