Printing to a file
John Esak
john at valar.com
Wed Sep 8 20:45:59 PDT 2004
<top posted>
Okay, let's start from the very beginning. (doe, a deer... a female deer...
:-) [don't mind me, it just sounded like that old song.. :-)
I think the first thing you should try is a simple export and see how that
works. You are going to design a filePro "processing-only" output format to
do this. It's only one line of code... so take heart.
I had told you how to run something from a command line. Normally, you would
design a filePro user menu and put the command I gave you on an action line
of the menu so you could perform the task over and over again. But, for the
moment, let's bypass that and just design and run this export from the
filePro Main Menu.
Let me describe how to export some data out of your filePro file into a .csv
file. This is a "comma,separated,values" file... which is a file format
that Excel can read directly and display. It is just what it sounds like,
each of your fields from any record separated by commas. (The field data
will have quotes around it... but these are ignored when the file is used by
any program. (Well there not ignored, they are used but the process is
invisible to the user.)
Each record's fields will be on a line by itself. You can designate which
fields to export. If the field is blank, this will be shown in the .csv file
as "". A .csv file might look something like this. (2 records worth...)
"Bill Jones","2 Hathaway Street","1295.00","495.23","","Group1"
"Joe Smith","32 Wilmer Drive","8495.00","222.24","ABC","Group2"
These might represent the numbered filePro fields from your file as follows:
14,15,9,11,295,3
Now, apparently we have selected only two records to dump into this .csv
file. You may sort and select whatever records you want to put into the .csv
in the same way you would sort/select records for any filePro output. Here
is the code and method you need to build and run the export above.
Go into Define Output and build a new "Processing Only" output called
"exp_test". You can follow the prompts to do this... I will assume you can
do this okay. If not, write back... Basically, just accept all the defaults
and don't change anything on the sort or printing pages at this point.
Essentially, once you've built the processing-only output format, you will
be left on a blank output screen because there is no "printed" output from
this type of format... it is "processing-only" :-). Anyway, once the format
is completely defined, you will have to press
(U)pdate and then F8 to see your options, and one of them will be "P Define
Processing For Format". This will bring you to where you have to write the
one line of code (and some assignments of which fields you want to export.)
Here is what you need to write on this If/Then screen.
if:
then: export WORD col=C:\myexport.csv
if:
then: col(1)=14; col(2)=15; col(3)=9
if:
then: col(4)=11; col(5)=295; col(6)=3
The single line of code for the export is the first line... It just says
that I want to put the data into a file called C:\myexport.csv. It also says
that I'm going to refer to the fields (i.e., the columns) in this file as
"col". Then, the next lines just assign the filePro field I want to
whichever column in the .csv file I want them in. In other words, even
though it is self-explanatory by looking at it... I'm putting the value of
my filePro field 14 into column 1 of the .csv file, putting the value of my
filePro field 15 into column 2, putting the value of my filePro field 9 into
column 3 ... and so forth.
Save this processing table out and run this output format in the same way
you would run any filePro output against any records in your file... perhaps
against ALL records, whatever you like. You will be left with a file called
C:\myexport.csv that contains all the data from the records you selected for
the output run. I'm assuming you would just go to Request Output and choose
the filePro file, the output format (exp_test), and the sort/selection as
you must do for other reports and forms.
This file C:\myexport.csv will have a little "X" on its icon as if it were
actually an Excel file. This is because Excel can read this simple format.
Just double click the icon for the file and it will open in Excel. (This is
just a text file and could also be dropped on Wordpad or Notepad....)
The special formatting of Description lines and special column formatting
can come later. It is pretty easy, too, though. For example if you wanted a
blank column in between two columns of data, you could just put something
like this on your processing table.
if:
then: col(9)=72; col(10)=73; col(11)=""; col(12)=109
and the 11th column would always be blank.
By the way, all that this processing table does as it stops on each record
you've selected for the output run is assign the fields to the columns
you've prescribed. On the very first record it encounters, it opens the
export .csv file and on every subsequent record the .csv file remains open
and each record is simply appended to it.
By your comments it was hard to tell exactly how much you know about
filePro. Since you've used it for many years, even if you haven't ever
written any processing, I'm sure this will be a breeze for you... I
didn't/don't want to talk "down" to you... so if I've been too basic, or not
basic enough... let me know.
Good luck,
John Esak
-----Original Message-----
From: filepro-list-bounces at lists.celestial.com
[mailto:filepro-list-bounces at lists.celestial.com]On Behalf Of Jim Fry
Sent: Wednesday, September 08, 2004 1:21 PM
To: filepro-list at lists.celestial.com
Subject: Printing to a file
Thank you for the offerings that I have received todate...some of you guys
really know your way around filepro....
Me, on the otherhand, I know where the gas goes & not much more... although
I've been working with filepro for more than a dozen years, I haven't done
that much programing work myself... I can dance to a certain degree but what
has been suggested is over my head... I thought that perhaps I should just
pull in my horns & keep going...but then again, maybe just one last question
just in case someone can tolerate a subject at this lowly level...
Here is one reply from John that I don't understand:
Well, it currently isn't possible with the rtf printcode table. It likes
courrier and a couple others (perhaps). I guess it would use and respect the
Letter Gothic font... but that is also mono-spaced.
If the end result is to get this output into Excel, could you just export
the data from filePro directly into an Excel table... and let Excel handle
the different font style you want? Rick, my colleague here, uses SYLK files
to get stuff nicely into Excel. I used to use these export files all the
time in Multiplan years ago... my bet is JPR still does this. :-) In any
case, the syntax is:
then: export MULTI myexcelfilename=c:\wherever-you-want-the-file
then: myexcelfilename(1)=13; myexcelfilename(2)=31; myexcelfilename(3)=14
...
then: end
On your first record, these fields would go into the Excel columns of row
one.
On your second record the same fields would go into row 2... and so forth.
The command to run this would be:
dreport filename -fp outputname -s selset ...
where the outputname is a processing only table that has the lines above on
it.
Glad I asked Rick about this first... good luck.
John
P.S. The syntax to start at a paricular row or column is:
export name=path r=n
and/or
export name=path c=n
My questions:
How do I "export the data from filePro directly into an Excel table"? Where
do I type the syntax?
I have attached a portion of the report I sent to a file just so you can see
what I'm trying to work with.
Once again.,,,, thank you.
- Jim
----- Original Message -----
From: Jim Fry
To: filepro-list at lists.celestial.com
Sent: Tuesday, September 07, 2004 3:57 PM
Subject: Printing to a file
Hello:
What I am trying to do is print an output to file.... & then be able to open
the file & copy and paste it into a newsletter...
We want to do a template in Microsoft Word or Microsoft Publisher....& then
be able to get the information from my output & paste it in easily.
When I did the print to file idea, I was able to find my output on my C
drive under Hardcopy.txt just fine but there are columns of numbers
involved... when I copy & pasted, the columns were all out of alignment & it
was more work than it should have been to do what I was trying to
accomplish.
I was told that there was something called 'enriched text format' that would
make my tast much easier...
Please help..
Thank you,
Jim Fry
More information about the Filepro-list
mailing list