dcc@ccvr1.ncsu.edu (Daniel Carr) (06/19/91)
in a previous post i said: i'm trying to set up a database so that we don't have to use foxbase mac's report generator. i would like to use MS Word's Print Merge feature, but i can't seem to get output from the database to be in a file that Word expects (i.e. a line with the field names, separated by tabs, and then each line being a record, with each field separated by tabs. i can do one or the other, but not both in the same file. if you know anyone doing this, please ask them to give me pointers. i'm about it give up. i had already known about SET ALTERNATE and COPY TO, but i didn't realize that i could use TYPE to achieve what i wanted. so here is what i have so far: COPY TO temp.txt NEXT 5 DELIMITED WITH TAB STORE FCOUNT() TO n STORE 1 TO x SET ALTERNATE TO printmerge.txt SET ALTERNATE ON DO WHILE x<n ??field(x) x=x+1 ENDDO ?field(n) TYPE temp.txt DELETE FILE temp.txt SET ALTERNATE OFF SET ALTERNATE TO ok, so it's a hack. my last problem is overcoming the barrier of 255 chars per string, or getting my field names, separated by tabs on one line. the problem i'm faced with is that ?? and ? appear to buffer the output to a string, and the string's max length is 255 chars. so foxbase happily truncates the string without telling me. so, besides shortening my field names, how can i get more that 255 chars in a string, or, more simply, how can i get more than 255 chars on one line? thanks for any help! daniel - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Carr North Carolina State University "Wow Bob wow" -- Twin Peaks final episode internet e-mail: daniel_carr@ncsu.edu bitnet e-mail: DANIEL@NCSUVM -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Carr North Carolina State University "Wow Bob wow" -- Twin Peaks final episode internet e-mail: daniel_carr@ncsu.edu
steve@violet.berkeley.edu (Steve Goldfield;232HMB;3-6292;;MF62) (06/20/91)
In article <1991Jun19.152025.14890@ncsu.edu> dcc@ccvr1.ncsu.edu (Daniel Carr) writes:
#>
#>in a previous post i said:
#>
#> i'm trying to set up a database so that we don't have to use foxbase
#> mac's report generator. i would like to use MS Word's Print Merge
#> feature, but i can't seem to get output from the database to be in a
#> file that Word expects (i.e. a line with the field names, separated by
#> tabs, and then each line being a record, with each field separated by
#> tabs. i can do one or the other, but not both in the same file.
#>
#> if you know anyone doing this, please ask them to give me pointers. i'm
#> about it give up.
You might try
COPY TO FILENAME SDF
Standard data format (SDF) has text inside double
quote marks, fields separated by commas, and a new line
for each record. Most word processors can read it in.
If you have to use a tab, you should be able to convert,
though you may have commas in your data. You can substitute
"," with "tab" in your word processor.
I generate data for WriteNow with SDF.
Steve Goldfield
alan@ahmcs.uucp (Alan Mintz) (06/22/91)
In article <1991Jun19.184113.2436@agate.berkeley.edu>, steve@violet.berkeley.edu (Steve Goldfield;232HMB;3-6292;;MF62) writes: > In article <1991Jun19.152025.14890@ncsu.edu> dcc@ccvr1.ncsu.edu (Daniel Carr) writes: > #> > #>in a previous post i said: > #> > #> i'm trying to set up a database so that we don't have to use foxbase > #> mac's report generator. i would like to use MS Word's Print Merge > #> feature, but i can't seem to get output from the database to be in a > #> file that Word expects (i.e. a line with the field names, separated by > #> tabs, and then each line being a record, with each field separated by > #> tabs. i can do one or the other, but not both in the same file. > #> > #> if you know anyone doing this, please ask them to give me pointers. i'm > #> about it give up. > > You might try > > COPY TO FILENAME SDF > > Standard data format (SDF) has text inside double > quote marks, fields separated by commas, and a new line > for each record. Most word processors can read it in. > If you have to use a tab, you should be able to convert, > though you may have commas in your data. You can substitute > "," with "tab" in your word processor. > > I generate data for WriteNow with SDF. Actually, SDF generates non-delimited, fixed-length records, like: <field_value1><field_value2><field_value3> <field_value1><field_value2><field_value3> <field_value1><field_value2><field_value3> . . . COPY TO blah DELIMITED generates the quoted, comma separated records. You can use DELIMITED WITH x, where x is a character to use instead of the ""s. If there are no ~ chars in your data, you could use: . use dbf_name . copy to dbf_name.txt delim with ~ This will generate a file that looks like: ~<field1_value>~,~<field2_value>~,~<field3_value>~ ~<field1_value>~,~<field2_value>~,~<field3_value>~ ~<field1_value>~,~<field2_value>~,~<field3_value>~ . . . Under UNIX, you could then do: cat dbf_name.txt | sed 's/~,~/ /g' | tr -d '~' > final.txt ^^ - That's a tab to turn the ~s into tabs. I presume there are tools on the Mac to accomplish the same thing ? -- < Alan H. Mintz | alan@ahmcs.mq.com | ...!uunet!ahmcs!alan >