Thread: [Solved] Help With Time Fields
View Single Post
 
Old 04-27-2017, 08:12 PM
JennEx JennEx is offline Windows XP Office 2013
Competent Performer
 
Join Date: May 2010
Posts: 162
JennEx is on a distinguished road
Default Help With Time Fields

I have two mergefields intended to display time values from my Excel data source.
Rather than displaying the times as they are in the database, they are displaying in the merged document as simply 12:00 AM. In the mail merge preview mode though, the times are correctly represented, but other time fields on my report are in decimal. When I merge, I get the 12:00A thing happening.

Here is a textual representation of my mailmerge field in which I am having difficulty with...

{QUOTE{SET OnTime {MERGEFIELD LIGHTS_ON_TIME} } {IF{= OnTime}<> {REF OnTime \* MERGEFORMAT } "N/A""{SET ss{= OnTime*86400 \# 0}}{SET hr{IF{ss}= 0 0 {= INT(ss/3600) \# 0}}}{SET mn{IF{ss}= 0 0 {= INT((ss-hr*3600)/60) \# 0}}}{SET AMPM{IF{hr}< 12 "AM" "PM"}}{= MOD({hr}+11,12)+1 \# 0}:{mn \# 00} {REF AMPM \* MERGEFORMAT }"} }

This has been carried over from a previous version of this report, so sadly I can honestly ay I'm unsure of how it works. I'm not sure what the N/A is all about. In earlier versions, the

The data in my worksheet from which the value for Lights_on_time is a time value (eg 9:00:00 PM) formatted as 9:00 PM.

I am simply looking to repair the formula I already have, or find a suitable alternative. I have tried a simple switch { MERGEFIELD LIGHTS_ON_TIME \@"h:mm AM/PM"} but I get the same behaviour as the merge field above. Proper representation of time in the mail merge document preview, but the merge document is 12:00 AM.
Reply With Quote