Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to retain the date format in CSV format?

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] How to retain the date format in CSV format?
 Login/Join
 
Gold member
posted
Hello,

I am trying to create a report that would output to CSV format by retaining the exact date format in the report. When I open the report, the date are getting converted to a different format (example: 01/07/2011 is showing as 20110107000000000). I tried reformatting in Excel to date format but it won't change it. I also tried to open in Notepad and the dates are already formatted differently.

This is a file that I need saved as .CSV and needs to be uploaded in a third party website according to the format specified. Below is the code I wrote:

-* File hirerightdva.fex
ENGINE SQLSYB SET DEFAULT_CONNECTION MARTENWARM
SQL SQLSYB
EX mastersys..HiredOrTermedDriversHireRight '&status1','&status2','&status3'
;

TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS SQLOUT
END

TABLE FILE SQLOUT
PRINT
userName AS 'Username'
password AS 'Password'
firstName AS 'First'
middleName AS 'Middle'
lastName AS 'Last'
ssn AS 'SSN'
dateOfBirth/HMDYY AS 'DOB'
stateOfLicense AS 'DLState'
licenseNumber AS 'DLNumber'
orderPurpose AS 'OrderPurpose'
hireDate/HMDYY AS 'HireDate'
termDate/HMDYY AS 'TermDate'
subAccount AS 'SubAccount'
referenceAppend AS 'ReferenceAppend'
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT COMT
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
LEFTMARGIN=0.500000,
RIGHTMARGIN=0.500000,
TOPMARGIN=0.500000,
BOTTOMMARGIN=0.500000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
TOPGAP=0.013889,
BOTTOMGAP=0.027778,
$
TYPE=TITLE,
STYLE=BOLD,
$
TYPE=TABHEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=TABFOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=HEADING,
SIZE=12,
STYLE=BOLD,
$
TYPE=FOOTING,
SIZE=12,
STYLE=BOLD,
$
TYPE=SUBHEAD,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBFOOT,
SIZE=10,
STYLE=BOLD,
$
TYPE=SUBTOTAL,
BACKCOLOR=RGB(210 210 210),
$
TYPE=ACROSSVALUE,
SIZE=9,
$
TYPE=ACROSSTITLE,
STYLE=BOLD,
$
TYPE=GRANDTOTAL,
BACKCOLOR=RGB(210 210 210),
STYLE=BOLD,
$
ENDSTYLE
END


Thanks for any help!

This message has been edited. Last edited by: Kerry,


Winnie

Webfocus 7.7.3
 
Posts: 83 | Registered: July 16, 2008Report This Post
Virtuoso
posted Hide Post
Use the FPRINT function.

Simple example:
SOMEDATE/A10=FPRINT( PROC_DT, 'YY-M-D', 'A10' ); 


"There is no limit to what you can achieve ... if you don’t care who gets the credit." Roger Abbott
 
Posts: 1102 | Location: Toronto, Ontario | Registered: May 26, 2004Report This Post
Expert
posted Hide Post
FPRINT?

Nice to know for future use.

From the WF 7.7.0.2 functions documentation:

"The FPRINT function converts any type of field except for a text field to its alphanumeric equivalent for display. The alphanumeric representation will include any display options that are specified in the format of the original field."


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Expert
posted Hide Post
For versions older than v7.7, try the following (assuming your input date is a date-time column):

SET HOLDLIST=PRINTONLY

DEFINE FILE CAR
DT1/HYYMDS = DT(20050601000000);
END

TABLE FILE CAR
PRINT
COUNTRY
COMPUTE DT1A/A8MDYY = HDATE(DT1, 'MDYY'); NOPRINT
COMPUTE DT1B/A10 = EDIT(DT1A,'99/99/9999');

-*ON TABLE PCHOLD FORMAT EXCEL
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
Thanks, Dhagen...we have the 7.6.8 version so the FPRINT doesn't work...

Francis, I did try the code you have below and it works only when the date is hardcoded in the DEFINE. I replaced it with the hiredate column and it gives me this error in my DEFINE.

(FOC177) INVALID DATE CONSTANT: HIREDATE

Here's the code I have...

SET HOLDLIST=PRINTONLY

DEFINE FILE SQLOUT
HIRE/HMDYYIA=DT( hireDate );
END
TABLE FILE SQLOUT
PRINT
userName AS 'Username'
password AS 'Password'
firstName AS 'First'
middleName AS 'Middle'
lastName AS 'Last'
ssn AS 'SSN'
dateOfBirth/HMDYY AS 'DOB'
stateOfLicense AS 'DLState'
licenseNumber AS 'DLNumber'
orderPurpose AS 'OrderPurpose'
hireDate/HMDYY AS 'HireDate'
termDate/HMDYY AS 'TermDate'
subAccount AS 'SubAccount'
referenceAppend AS 'ReferenceAppend'
COMPUTE DT1A/A8MDYY = HDATE(HIRE,'MDYY');NOPRINT
COMPUTE DT1B/A10 = EDIT(DT1A,'99/99/9999');

.....

Thanks!


Winnie

Webfocus 7.7.3
 
Posts: 83 | Registered: July 16, 2008Report This Post
Expert
posted Hide Post
The DT() "function" can only use a numeric string constant, not a data column.

What is the format of hireDate in the SQLOUT HOLD file? You can determine that by issuing a
?FF SQLOUT
command.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
FILENAME= SQLOUT

hireDate E11 HYYMDI


Winnie

Webfocus 7.7.3
 
Posts: 83 | Registered: July 16, 2008Report This Post
Expert
posted Hide Post
The DEFINE sets up a date-time field like the one you have in your HOLD file - you do not require this in your code.

The COMPUTEs are required - one extracts the date from the date-time field, the other formats an alpha field to look like a date.

SET HOLDLIST=PRINTONLY

DEFINE FILE CAR
hireDate /HYYMDI = DT(20050601000000);
END

TABLE FILE CAR
PRINT
COUNTRY
hireDate 
COMPUTE DT1A/A8MDYY = HDATE(hireDate, 'MDYY');
COMPUTE DT1B/A10 = EDIT(DT1A,'99/99/9999');

-*ON TABLE PCHOLD FORMAT EXCEL
END


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
 
Posts: 10577 | Location: Toronto, Ontario, Canada | Registered: April 27, 2005Report This Post
Gold member
posted Hide Post
This works, Francis...Thank you very much for all the help! Smiler


Winnie

Webfocus 7.7.3
 
Posts: 83 | Registered: July 16, 2008Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] How to retain the date format in CSV format?

Copyright © 1996-2020 Information Builders