Passing FOCUS Dates to Excel 2000/2003

In this section:

By default, when FOCUS creates dates in Excel 2000/2003 (EXL2K) format, the date formats that contain translated values, such as month or day name, are sent as formatted text, preserving the style defined for the report field. Numeric dates are passed to Excel 2000/2003 as standard date values, not as text.


Top of page

x
Passing Dates With Translated Text to Excel 2000/2003

How to:

Reference:

Some translated dates can be sent to Excel 2000/2003 as standard date values with format masks, enabling Excel to use them in functions, formulas, and sort sequences. The SET EXL2KTXTDATE command allows you to specify that translated dates should be sent as date values with format masks instead of text values.



x
Syntax: How to Pass Translated Dates to Excel 2000/2003 as Date Values
SET EXL2KTXTDATE = {TEXT|VALUE}

where:

TEXT

Passes date values that contain text to Excel 2000/2003 as formatted text. TEXT is the default value.

VALUE

Passes the types of translated date values that contain text and are supported Excel date formats to Excel 2000/2003 as standard date values with text format masks applied.



x
Reference: Usage Notes for SET EXL2KTXTDATE


Example: Passing Dates With Translated Text to Excel 2000

The following request against the GGSALES data source creates the date January 1, 2010 and converts it to four date formats with translated text:

SET EXL2KTXTDATE=TEXT
DEFINE FILE GGSALES
NEWDATE/MDYY = '01/01/2010';
WRMtrDY/WRMtrDY = NEWDATE;
wDMTY/wDMTY = NEWDATE;
wrDMTRY/wrDMTRY = NEWDATE;
wrYMtrD/wrYMtrD = NEWDATE;
END
TABLE FILE GGSALES
SUM DATE NOPRINT
NEWDATE WRMtrDY wDMTY wrDMTRY wrYMtrD
ON TABLE HOLD FORMAT EXL2K
END

The following table shows how the dates should appear with EXL2KTXTDATE set to TEXT and to VALUE:

FOCUS Format

SET EXL2KTXTDATE=TEXT

SET EXL2KTXTDATE=VALUE

EXL2K Displays:

EXL2K Value:

EXL2K Displays:

EXL2K Value:

WRMtrDY

FRIDAY, January 1 10

FRIDAY, January 1 10

Friday, January 1 10

1/1/2010

wDMTY

Fri, 1 JAN 10

Fri, 1 JAN 10

Fri, 1 Jan 10

1/1/2010

wrDMTRY

Friday, 1 JANUARY 10

Friday, 1 JANUARY 10

Friday, 1 January 10

1/1/2010

wrYMtrD

Friday, 10 January 1

Friday, 10 JANUARY 1

Friday, 10 January 1

1/1/2010

With SET EXL2KTXTDATE=TEXT, in Excel 2000/2003 all the cells with month or day translation are sent as text, and all month and day names are in the case specified by the FOCUS format.

The output is:

With SET EXL2KTXTDATE=VALUE, in Excel 2000/2003 all of the cells have a date value with format masks, and all month and day names are in mixed-case, regardless of how the case has been specified in the FOCUS format.

The output is:



x
Passing Dates Without a Day Component

Date formats that do not specify the day value explicitly are defined as the date value of the first day of the month. Therefore, the value placed in the cell may be different from the day component value in the source data field and may produce unexpected results when used for sorting or date calculations in an Excel formula.

The following table shows how FOCUS date formats are represented in EXL2K. The table shows how the value is preserved in the cell and how the display is generated using the format mask that corresponds to the FOCUS date format.

DATEFLD/MDYY = '01/02/2010'

FOCUS Format

SET EXL2KTXTDATE=TEXT

SET EXL2KTXTDATE=VALUE

EXL2K Displays:

EXL2K Value:

EXL2K Displays:

EXL2K Value:

DMYY

02/01/2010

1/2/2010

02/01/2010

1/2/2010

MY

01/10

1/1/2010

01/10

1/1/2010

MTY

JAN, 10

JAN, 10

Jan, 10

1/1/2010

MTDY

JAN 2, 10

JAN 2, 10

Jan 2, 10

1/2/2010



Example: Passing FOCUS Dates With and Without a Day Component to Excel 2000/2003

The following request against the GGSALES data source creates the date January 2, 2010 and passes it to Excel 2000/2003 with formats MDYY, DMYY, MY, and MTDY:

SET EXL2KTXTDATE=TEXT
DEFINE FILE GGSALES
NEWDATE/MDYY = '01/02/2010';
END
TABLE FILE GGSALES
SUM DATE NOPRINT
NEWDATE AS 'MDYY' NEWDATE/DMYY AS 'DMYY' NEWDATE/MY AS 'MY' 
        NEWDATE/MTY AS 'MTY' NEWDATE/MTDY AS 'MTDY'
ON TABLE HOLD FORMAT EXL2K 
END

With EXL2KTXTDATE=TEXT, columns D and E have text values, not date values. The values are displayed in uppercase, as specified by the FOCUS formats (MTY and MTDY):

With EXL2KTXTDATE=VALUE, columns D and E have actual date values with format masks, displayed by Excel 2000 in mixed-case. Since the MTY format does not have a day component, the date value stored is the first of January 2010 (1/1/2010), not the second of January 2010 (1/2/2010):


Top of page

x
Passing Date Components for Use in Excel Formulas

Dates formatted as individual components (for example, D, Y, M, W) are passed to Excel as numeric values that can be used as parameters to Excel date functions. The values are passed as general text format that are recognized by Excel as numbers. These values are passed to Excel in the same format regardless of the setting for EXL2KTXTDATE.



Example: Passing Numeric Date Components to Excel 2000/2003

The following request against the GGSALES data source creates the date January 1, 2010 and extracts numeric date components, passing them to Excel 2000:

SET EXL2KTXTDATE=VALUE
DEFINE FILE GGSALES
NEWDATE/MDYY = '01/01/2010';
D/D = NEWDATE;
Y/Y = NEWDATE;
W/W = NEWDATE;
w/w = NEWDATE;
M/M = NEWDATE;
YY/YY = NEWDATE;
END
TABLE FILE GGSALES
SUM DATE NOPRINT
NEWDATE D Y W w M YY
ON TABLE HOLD FORMAT EXL2K 
END

With SET EXL2KTXTDATE=VALUE, the output is:


Top of page

x
Passing Quarter Formats

Date formats that contain a Quarter component are always passed to Excel as text strings since Excel does not support Quarter formats.



Example: Passing Dates With a Quarter Component to Excel 2000/2003

The following request against the GGSALES data source creates the date January 1, 2010 and converts it to date formats that contain a Quarter component:

SET EXL2KTXTDATE=VALUE
DEFINE FILE GGSALES
NEWDATE/MDYY = '01/01/2010';
Q/Q = NEWDATE;
QY/QY = NEWDATE;
YBQ/YBQ = NEWDATE;
END
TABLE FILE GGSALES
SUM DATE NOPRINT
NEWDATE Q QY YBQ
ON TABLE HOLD FORMAT EXL2K 
END

Even with SET EXL2KTXTDATE=VALUE, in Excel 2000/2003 the cells containing dates with Quarter components have General format. To see this, open the Format Cells dialog box.

The output is:


Top of page

x
Passing Date Components Defined as Translated Text

Date formats that do not contain sufficient information to present the valid date result in Excel are not translated to a value, including formats that do not contain year and/or month information. These dates will continue to be sent to Excel as text regardless of the SET EXL2KTXTDATE setting. In the absence of complete information, the year defaults to the current year, so the value sent would be incorrect if this type of format was passed as a date value. The following formats will not be sent as values:

Note that since these values are always sent as text, the case defined in the FOCUS format is applied in the resulting cell.



Example: Passing Date Components Defined as Translated Text to Excel 2000/2003

The following request against the GGSALES data source creates the date January 1, 2010 and converts it to date formats that are defined as either month name or day name:

SET EXL2KTXTDATE=VALUE
DEFINE FILE GGSALES
NEWDATE/MDYY = '01/01/2010';
MT/MT = NEWDATE;
MTR/MTR = NEWDATE;
Mtr/Mtr = NEWDATE;
WR/WR = NEWDATE;
wr/wr = NEWDATE;
END
TABLE FILE GGSALES
SUM DATE NOPRINT
NEWDATE MT MTR Mtr WR wr
ON TABLE HOLD FORMAT EXL2K 
END

In Excel 2000/2003, the cells containing the days have General format. To see this, open the Format Cells dialog box.

The output is:


Information Builders