Focal Point
[SOLVED]Adding extra spaces with format comma

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/268104044

May 12, 2010, 12:49 PM
Malinda
[SOLVED]Adding extra spaces with format comma
When I output to html everything is working and formatted fine. But when I switch to output to a csv file, format comma, it seems to add extra spaces in some of my defines fields.

Here is the output to html:

TERM SITE_ID START_DATE TITLE COURSE_ID Descr PUBLISH END_DATE TEMPLATE 
Fall 2010 1108.12754 2010-08-23 AGRI 431 0089-1-INTERNATIONAL FOOD POLICY AGRI 431 0089-1 INTERNATIONAL FOOD POLICY 0 2010-12-17 template.webenhanced 
Fall 2010 1108.10929 2010-08-23 AGRI 438 0089-1-LAND RESOURCE MGMT PLANNING AGRI 438 0089-1 LAND RESOURCE MGMT PLANNING 0 2010-12-17 template.webenhanced 
Fall 2010 1108.10929 2010-08-23 AGRI 538 0089-1-LAND RESOURCE MGMT PLANNING AGRI 538 0089-1 LAND RESOURCE MGMT PLANNING 0 2010-12-17 template.webenhanced 
Fall 2010 1108.10493 2010-08-23 ART 131 0001-1-DRAWING I ART 131 0001-1 DRAWING I 0 2010-12-17 template.webenhanced 
Fall 2010 1108.10649 2010-08-23 ART 325 001-1-PRINTMAKING II ART 325 001-1 PRINTMAKING II 0 2010-12-17 template.webenhanced 
Fall 2010 1108.10666 2010-08-23 ART 339 0001-1-ART HISTORY SURVEY II ART 339 0001-1 ART HISTORY SURVEY II 0 2010-12-17 template.webenhanced 
Fall 2010 1108.11651 2010-08-23 BIOL 221 0079-1-BIOTERMINOLOGY BIOL 221 0079-1 BIOTERMINOLOGY 0 2010-12-17 template.webenhanced 
Fall 2010 1108.12902 2010-08-23 BIOL 458 0079-1-EVOLUTION BIOL 458 0079-1 EVOLUTION 0 2010-12-17 template.webenhanced 
  


Here is the output to comma:
"Fall 2010                                         ","1108.12754 ","2010-08-23","AGRI     431       0089-1-INTERNATIONAL FOOD POLICY       ","AGRI     431       0089-1  ","INTERNATIONAL FOOD POLICY     ","0","2010-12-17","template.webenhanced     "
"Fall 2010                                         ","1108.10929 ","2010-08-23","AGRI     438       0089-1-LAND RESOURCE MGMT PLANNING     ","AGRI     438       0089-1  ","LAND RESOURCE MGMT PLANNING   ","0","2010-12-17","template.webenhanced     "
"Fall 2010                                         ","1108.10929 ","2010-08-23","AGRI     538       0089-1-LAND RESOURCE MGMT PLANNING     ","AGRI     538       0089-1  ","LAND RESOURCE MGMT PLANNING   ","0","2010-12-17","template.webenhanced     "
"Fall 2010                                         ","1108.10493 ","2010-08-23","ART      131       0001-1-DRAWING I                       ","ART      131       0001-1  ","DRAWING I                     ","0","2010-12-17","template.webenhanced     "
"Fall 2010                                         ","1108.10649 ","2010-08-23","ART      325       001-1-PRINTMAKING II                   ","ART      325       001-1   ","PRINTMAKING II                ","0","2010-12-17","template.webenhanced     "
"Fall 2010                                         ","1108.10666 ","2010-08-23","ART      339       0001-1-ART HISTORY SURVEY II           ","ART      339       0001-1  ","ART HISTORY SURVEY II         ","0","2010-12-17","template.webenhanced     "
"Fall 2010                                         ","1108.11651 ","2010-08-23","BIOL     221       0079-1-BIOTERMINOLOGY                  ","BIOL     221       0079-1  ","BIOTERMINOLOGY                ","0","2010-12-17","template.webenhanced     "
"Fall 2010                                         ","1108.12902 ","2010-08-23","BIOL     458       0079-1-EVOLUTION                       ","BIOL     458       0079-1  ","EVOLUTION                     ","0","2010-12-17","template.webenhanced     "
 


In the html it lists AGRI 431 0089-1-International Food Policy nicely but in the format comma it puts extra spaces between the subject, course number and section number. Why?

Malinda

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


WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)
May 12, 2010, 12:56 PM
Darin Lee
I'll bet those spaces are there in HTML as well, but when you display that in a browser, it automatically compresses all those blank spaces into a single space. However, when outputting to a CSV file, if you tell it there an A40 field, you're going to get 40 characters, whether or not most of them are spaces.

Is the subject course number and section number all one field in the database or are you creating that using concatenation?


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
May 12, 2010, 01:11 PM
Malinda
Ah....true. The subject, course number and section number are all in separate fields in my db. In my define I only had a | separating the subject and course number. I switched this to a || and this only puts 1 space between them. My problem is that I actually don't want any spaces between the subject and course number but I do want 1 space between the course number and section number. Here is how I defined it:

 TITLE/A58=CSQASC_CLASS_TBL.CSQASC_CLASS_TBL.SUBJECT || CSQASC_CLASS_TBL.CSQASC_CLASS_TBL.CATALOG_NBR |' '| CSQASC_CLASS_TBL.CSQASC_CLASS_TBL.CLASS_SECTION ||'-'|| CSQASC_CLASS_TBL.CSQASC_CLASS_TBL.SESSION_CODE ||'-'|| CSQASC_CLASS_TBL.CSQASC_CLASS_TBL.DESCR;
 



WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)
May 12, 2010, 02:03 PM
njsden
From documentation:
quote:
The following example shows how to use the SUBSTR function to extract the first initial from a first name, and then use both strong and weak concatenation to produce the last name, followed by a comma, followed by the first initial, followed by a period:

First_Init/A1 = SUBSTR (First_Name, 1, 1);
Name/A19 = Last_Name || (', ' | First_Init | '.');


This should give you some ideas.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
May 12, 2010, 03:24 PM
RSquared
Try using the SQEEZ Function.

SQCNAME/A38 = SQUEEZ(38, CASE_NAME, 'A38');


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
May 12, 2010, 03:37 PM
Malinda
I did keep messing around with putting things into parenthesis and I think I got it to where I want it. Thanks!

Malinda


WebFOCUS 7.6.11
Windows
all output (Excel, HTML, PDF)