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. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Generating CSV files as ouput

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Generating CSV files as ouput
 Login/Join
 
<Aparna>
posted
Hi,
I have a .fex file which generates Excel file. I want to know what changes need to be done to generate CSV files. I tried specifying output type as COMMA but it printed the output in Explorere itself. Please do help me wih this
 
Report This Post
Platinum Member
posted Hide Post
Trying changing from
ON TABLE PCHOLD AS whatever FORMAT COMMA
to
ON TABLE HOLD AS whatever FORMAT COMMA

I'm assuming you've got a FILEDEF for the file...

Let me know if it works.
 
Posts: 118 | Location: DC | Registered: May 13, 2005Report This Post
<Aparna>
posted
thanks for your reply. But I am not able to apply it to my .fex. Kindly go through my code below and let me know where I can incorporte the changes you have suggested.


In my .fex file I have an Inline query like

SELECT * from tab1;

TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS myhold
END


TABLE FILE myhold
PRINT
fld1
fld2

BY HIGHEST fld3 NOPRINT
BY fld4 NOPRINT

ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT EXL2K
END


now how to change this file to get CSV files?
 
Report This Post
Virtuoso
posted Hide Post
change
ON TABLE SET ONLINE-FMT EXL2K

to
ON TABLE HOLD AS whatever FORMAT COMMA

And as Codermonkey said...filedef the file.


In Focus since 1993. WebFOCUS 7.7.03 Win 2003
 
Posts: 1903 | Location: San Antonio | Registered: February 28, 2005Report This Post
<Aparna>
posted
FILEDEF HOLDINGS DISK C:\REP

SQL SQLORA SET SERVER SER1
SQL SQLORA
SELECT * from tab1;

TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS myhold
END


TABLE FILE myhold
PRINT
fld1
fld2

BY HIGHEST fld3 NOPRINT
BY fld4 NOPRINT

ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE HOLD AS myhold FORMAT COMMA
END

I did this and it gives the error:

(FOC1517) UNRECOGNIZED COMMAND null
0 NUMBER OF RECORDS IN TABLE= 28 LINES= 28
0 NUMBER OF RECORDS IN TABLE= 28 LINES= 28
 
Report This Post
Platinum Member
posted Hide Post
I get the FOC1517 error message alot and just ignore it. It's complaining about something but doesn't have any effect on your focexec. It looks like your code created a temporary hold file named myhold.prn containing 28 records. You then need to copy that file somewhere or use a filedef to place it where you want. I create .csv files using FORMAT COMT (this includes titles) or FORMAT COM (no titles) and then use a copy command to copy the file to a network drive.

Here's an example using the CAR file:
----------------------------------------------------
TABLE FILE CAR
PRINT
CAR
BY COUNTRY
ON TABLE HOLD AS FORUM859 FORMAT COMT
END
-*
CMD COPY FORUM859.* \\some\network\drive\forum
----------------------------------------------------

Here's the messages returned: (I ignore the FOC1517 message)
----------------------------------------------------
(FOC1517) UNRECOGNIZED COMMAND null
0 NUMBER OF RECORDS IN TABLE= 10 LINES= 10
forum859.csv
forum859.mas
2 file(s) copied.
----------------------------------------------------

Here's the contents of forum859.csv in directory \\some\network\drive\forum
----------------------------------------------------
"COUNTRY","CAR"
"ENGLAND","JAGUAR"
"ENGLAND","JENSEN"
"ENGLAND","TRIUMPH"
"FRANCE","PEUGEOT"
"ITALY","ALFA ROMEO"
"ITALY","MASERATI"
"JAPAN","DATSUN"
"JAPAN","TOYOTA"
"W GERMANY","AUDI"
"W GERMANY","BMW"
---------------------------------------------------

Here's the contents of forum859.mas in directory \\some\network\drive\forum
---------------------------------------------------
FILE=FORUM859 ,SUFFIX=COMT
SEGNAME=FORUM859,SEGTYPE=S01
FIELDNAME =COUNTRY ,E01 ,A10 ,A10 ,$
FIELDNAME =CAR ,E02 ,A16 ,A16 ,$
---------------------------------------------------

Hope this helps.
Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 2005Report This Post
Silver Member
posted Hide Post
Aparna, on that last sample you submitted, change the statement:

ON TABLE HOLD AS myhold FORMAT COMMA

to

ON TABLE HOLD AS HOLDINGS FORMAT COMMA

I use an older version of Focus and use FORMAT LOTUS for this, but if COMMA is valid, then this should work.
 
Posts: 40 | Registered: March 10, 2004Report This Post
<Aparna>
posted
I tried the following:

TABLE FILE CAR
PRINT
CAR
BY COUNTRY
ON TABLE HOLD AS FORUM859 FORMAT COMT
END
-*
CMD COPY FORUM859.* C:\TEMP\BRIO

Message given is:


0 NUMBER OF RECORDS IN TABLE= 10 LINES= 10
(FOC1569) SYSTEM COMMANDS DISABLED. CAN NOT EXECUTE cmd COPY FORUM859.*
C:\TEMP\BRIO



No files were written in teh path specified. My IBI version is : 524
 
Report This Post
Platinum Member
posted Hide Post
Aparna,

Try using a FILEDEF command as follows:

FILEDEF FORUM859 DISK \\some\network\drive\forum\forum859_test.csv
-*
TABLE FILE CAR
PRINT
CAR
BY COUNTRY
ON TABLE HOLD AS FORUM859 FORMAT COMT
END

Jim


WF DevStu 5.2.6/WF Srv 5.2.4/Win NT 5.2
 
Posts: 118 | Location: Lincoln Nebraska | Registered: May 04, 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     Generating CSV files as ouput

Copyright © 1996-2020 Information Builders