Hot Topic (More than 10 Replies) Date formatting when printing a merged document . (Read 1224 times)
Brett_in_Australia
Member
*
Offline


Having a nice nap under
a tree sounds good to
me

Posts: 14
Location: Australia
Joined: Feb 20th, 2004
Date formatting when printing a merged document .
Feb 21st, 2004 at 2:48am
Print Post Print Post  
HELP! How the heck do I mail merge a date field in a document while retaing the formatting that I set in Sesame.  I can currently only merge the Sesame native date format 'YYYY/MM/DD'.  'I was able do this in Q&A' LOL

Thanks  Smiley
  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Date formatting when printing a merged documen
Reply #1 - Feb 21st, 2004 at 7:25am
Print Post Print Post  
The solution, though, lies outside of Sesame. It's to use Word's field switches.

Firstly, in your merge document, show the field code rather than the result. To do this click on the field and press Shift F9, or press Alt F9 to toggle all field codes.

Click at the end of the field code and add the appropriate switch.  For example, change ..

{MERGEFIELD Date}
to 
{MERGEFIELD Date \@ "MMMM dd, yy"}

Where "Date" is the column heading ("field name") of the field in question. The field code starts with the \ character.

By this means you can vary the number of decimal places for numbers, format dates any way you want, and turn numbers into currency amounts.  Here are some examples...

Dates

\@ "MM/dd/yyyy"     produces         11/19/2003
\@ "MM-dd-yy"      produces         11-19-03
\@ "dd MMM yy"      produces         19 Nov 03
\@ "dddd, MMMM d, yyyy"   produces    Wednesday, November 19, 2003

Numbers & Currency
     
Example = 1237.852941

\#0.00      produces  1237.85
\#0      produces             38
\#$#,###.00      produces      $  1,237.85
\#£#,###      produces      £  1,238


Text

\* Upper      produces  NY  from "ny"
\* Caps    produces   New York  from "new york"

Once you've set the field code, press Shift F9 to display the value again. Don't be alarmed - it will still show the previous formatting. Press F9 to 'refresh' the field.

This is described in the Programming Guide pages 242-243.

==============
above is copied from explanation given by Alec in the earlier link in regards to the similar question.

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...
  
Back to top
 
IP Logged
 
Brett_in_Australia
Member
*
Offline


Having a nice nap under
a tree sounds good to
me

Posts: 14
Location: Australia
Joined: Feb 20th, 2004
Re: Date formatting when printing a merged documen
Reply #2 - Feb 22nd, 2004 at 12:51pm
Print Post Print Post  
Quote:
The solution, though, lies outside of Sesame. It's to use Word's field switches.

Firstly, in your merge document, show the field code rather than the result. To do this click on the field and press Shift F9, or press Alt F9 to toggle all field codes.

Click at the end of the field code and add the appropriate switch.  For example, change ..

{MERGEFIELD Date}
to  
{MERGEFIELD Date \@ "MMMM dd, yy"}

Where "Date" is the column heading ("field name") of the field in question. The field code starts with the \ character.

By this means you can vary the number of decimal places for numbers, format dates any way you want, and turn numbers into currency amounts.  Here are some examples...

Dates

\@ "MM/dd/yyyy"     produces         11/19/2003
\@ "MM-dd-yy"      produces         11-19-03
\@ "dd MMM yy"      produces         19 Nov 03
\@ "dddd, MMMM d, yyyy"   produces    Wednesday, November 19, 2003

Numbers & Currency
     
Example = 1237.852941

\#0.00      produces  1237.85
\#0      produces             38
\#$#,###.00      produces      $  1,237.85
\#£#,###      produces      £  1,238


Text

\* Upper      produces  NY  from "ny"
\* Caps    produces   New York  from "new york"

Once you've set the field code, press Shift F9 to display the value again. Don't be alarmed - it will still show the previous formatting. Press F9 to 'refresh' the field.

This is described in the Programming Guide pages 242-243.

==============
above is copied from explanation given by Alec in the earlier link in regards to the similar question.

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...


Thanks for the prompt reply  Smiley but if your not using Word (Publisher etc.) for your merged data . . . what then ???
  
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Date formatting when printing a merged documen
Reply #3 - Feb 22nd, 2004 at 1:24pm
Print Post Print Post  
Quote:
but if your not using Word (Publisher etc.) for your merged data . . . what then


What program are you using to produce the mail merge document?
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Brett_in_Australia
Member
*
Offline


Having a nice nap under
a tree sounds good to
me

Posts: 14
Location: Australia
Joined: Feb 20th, 2004
Re: Date formatting when printing a merged documen
Reply #4 - Feb 22nd, 2004 at 1:27pm
Print Post Print Post  
Im using Publisher 2003 . . . i cant find any formatting options with Publisher and nothing in Help or online about them either !!!
  
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Date formatting when printing a merged documen
Reply #5 - Feb 22nd, 2004 at 1:39pm
Print Post Print Post  
This topic has been discussed with workaround in the following link.

http://www.lantica.com/Forum2/cgi-bin/yabb/YaBB.pl?board=gen_disc;action=display...
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Date formatting when printing a merged documen
Reply #6 - Feb 22nd, 2004 at 2:52pm
Print Post Print Post  
Since you are concerned about Date formating (merging in other than Word), you might have to make one more text field and convert the internally stored date into the format you desired by Sbasic code.

The date is internally stored as YYYY/MM/DD

Let's say Date1 is the date field
TextDate it a new text field you are adding

for 12/31/2003 format
===============
TextDate = @STR (@MONTH(DATE1)) + "/" + @STR (@DOM (DATE1)) + "/" + @STR (@YEAR (DATE1))

for 31/12/2003 format
==============
TextDate = @STR (@DOM (DATE1)) + "/" + @STR (@MONTH(DATE1)) + "/" +  @STR (@YEAR (DATE1))

  
Back to top
 
IP Logged
 
Brett_in_Australia
Member
*
Offline


Having a nice nap under
a tree sounds good to
me

Posts: 14
Location: Australia
Joined: Feb 20th, 2004
Re: Date formatting when printing a merged documen
Reply #7 - Feb 25th, 2004 at 11:20am
Print Post Print Post  
[quote author=Bharat_Naik  link=1077331704/0#6 date=1077461572]Since you are concerned about Date formating (merging in other than Word), you might have to make one more text field and convert the internally stored date into the format you desired by Sbasic code.

The date is internally stored as YYYY/MM/DD

Let's say Date1 is the date field
TextDate it a new text field you are adding

for 12/31/2003 format
===============
TextDate = @STR (@MONTH(DATE1)) + "/" + @STR (@DOM (DATE1)) + "/" + @STR (@YEAR (DATE1))

for 31/12/2003 format
==============
TextDate = @STR (@DOM (DATE1)) + "/" + @STR (@MONTH(DATE1)) + "/" +  @STR (@YEAR (DATE1))

[/quote]

Thanks people :) . . . me being the non programming type ended up working out the following solution to my problem, which works too! LOL . . .

for 12 December 2004 Format . . .

SUPPORTEXPIRES (DATE) - Original Date Field
SUPPORTEXPIRESTEXT (TEXT) - Converted Date Format Field

IF @MID(SUPPORTEXPIRES, 6,2) = "01" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "January" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "02" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "Febuary" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "03" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "March" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "04" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "April" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "05" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "May" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "06" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "June" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "07" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "July" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "08" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "August" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "09" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "September" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "10" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "October" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "11" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "November" + " " + @MID(SUPPORTEXPIRES, 1,4)
ELSE IF @MID(SUPPORTEXPIRES, 6,2) = "12" THEN SUPPORTEXPIRESTEXT = @MID(SUPPORTEXPIRES,9,2) + " " + "December" + " " + @MID(SUPPORTEXPIRES, 1,4)

  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Date formatting when printing a merged documen
Reply #8 - Feb 25th, 2004 at 12:51pm
Print Post Print Post  
Brett,

You can get the same results with much less code, like this:

SUPPORTEXPIRESTEXT = @DOM(SUPPORTEXPIRES) + " " + @Month$(SUPPORTEXPIRES) + " " + @Year(SUPPORTEXPIRES)

It will also take a date and produce text in this format: 12 December 2004
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Brett_in_Australia
Member
*
Offline


Having a nice nap under
a tree sounds good to
me

Posts: 14
Location: Australia
Joined: Feb 20th, 2004
Re: Date formatting when printing a merged documen
Reply #9 - Feb 25th, 2004 at 1:28pm
Print Post Print Post  
Quote:
Brett,

You can get the same results with much less code, like this:

SUPPORTEXPIRESTEXT = @DOM(SUPPORTEXPIRES) + " " + @Month$(SUPPORTEXPIRES) + " " + @Year(SUPPORTEXPIRES)

It will also take a date and produce text in this format: 12 December 2004


Sheesh, thanks a heap Carl, you can tell im not a programmer Smiley
  
Back to top
IP Logged
 
Bob_Hansen
Senior Member
Members
*****
Offline


WOW, They have the Internet
on computers now!

Posts: 1861
Location: Salem, NH
Joined: Nov 24th, 2002
Re: Date formatting when printing a merged documen
Reply #10 - Feb 25th, 2004 at 9:48pm
Print Post Print Post  
Quote:
SUPPORTEXPIRESTEXT = @DOM(SUPPORTEXPIRES) + " " + @Month$(SUPPORTEXPIRES) + " " + @Year(SUPPORTEXPIRES)


Take Carl's expression, change SUPPORTEXPIRES into a variable and create a DateText() function that you can call for any date field.
  



Bob Hansen
Sesame Database Manager Professional
Sensible Solutions Inc.
Salem, NH
603-898-8223
Skype ID = sensiblesolutions
Back to top
IP Logged