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] CSV With Headers & No Space Padding

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] CSV With Headers & No Space Padding
 Login/Join
 
Platinum Member
posted
When I output to COMMA, the resulting csv file has the layout I'm looking for (comma separated, with double quotes around each field value.

However the field values appear to be space padded to the same length. Is there a way to remove this space padding?


My Code:

TABLE FILE CAR
PRINT 
COUNTRY  
MODEL
ON TABLE PCHOLD FORMAT COMMA
END

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


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Expert
posted Hide Post
See if format COM fits your needs.

quote:
Saves the data values as a variable-length text file with fields separated by commas and with character values enclosed in double quotation marks. Leading blanks are removed from numeric fields, and trailing blanks are removed from character fields. To issue a request against this data source, the setting PCOMMA=ON is required.

This format also includes a built-in safety feature, which allows embedded quotes within character fields. A second double quote (") is inserted adjacent to the existing one. For example, if you input Joe "Smitty" Smith, the output is Joe ""Smitty"" Smith.


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
Platinum Member
posted Hide Post
Where did you find this quote?

Changing to the below gives me a CSV, but no quotes.

TABLE FILE CAR
PRINT 
COUNTRY  
MODEL
ON TABLE PCHOLD FORMAT COM
END



Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Expert
posted Hide Post
-* File fm_csv1.fex
TABLE FILE CAR
PRINT 
COUNTRY  
MODEL
ON TABLE PCHOLD FORMAT COM
END


"ENGLAND","V12XKE AUTO"
"ENGLAND","XJ12L AUTO"
"ENGLAND","INTERCEPTOR III"
"ENGLAND","TR7"
"JAPAN","B210 2 DOOR AUTO"
"JAPAN","COROLLA 4 DOOR DIX AUTO"
"ITALY","2000 4 DOOR BERLINA"
"ITALY","2000 GT VELOCE"
"ITALY","2000 SPIDER VELOCE"
"ITALY","DORA 2 DOOR"
"W GERMANY","100 LS 2 DOOR AUTO"
"W GERMANY","2002 2 DOOR"
"W GERMANY","2002 2 DOOR AUTO"
"W GERMANY","3.0 SI 4 DOOR"
"W GERMANY","3.0 SI 4 DOOR AUTO"
"W GERMANY","530I 4 DOOR"
"W GERMANY","530I 4 DOOR AUTO"
"FRANCE","504 4 DOOR"


Documentation: Creating Reports With WebFOCUS Language > Saving and Reusing Your Report Output > Choosing Output File Formats > FORMAT COM

Note that when a csv file is opened in Excel, you won't see the double quotes. If the file is opened in a text editor, you should see the double quotes. I'm doing this in v7.7.05 but this behaviour should be the same for v7.6.


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
Platinum Member
posted Hide Post
ok, that's working.

I thought I was doing the same thing, but after run or run deferred, it was opening by default in Excel and then I was saving it as CSV, and then opening in text editor.

When I run it to format COM, AND run it in report caster as format COM, then it opens with text editor by default.

Thank you for your help!


Production - 7.6.4
Sandbox - 7.6.4
 
Posts: 241 | Location: Bethesda, MD | Registered: August 14, 2007Report This Post
Expert
posted Hide Post
Whether it opens in text or Excel is up to Windows or the user. IMHO: Use the FORMAT COM, COMT, XLSX as the user intends to open it. There's no reason to use FORMAT COM and open it in Excel and saving it as CSV, that's just an extraneous step.
 
Posts: 3132 | Location: Tennessee, Nashville area | Registered: February 23, 2005Report 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] CSV With Headers & No Space Padding

Copyright © 1996-2020 Information Builders