Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem exporting to text file 1

Status
Not open for further replies.

DjangMan

Programmer
Jun 1, 2001
1,783
CA
Hi all,

I have a report that exports it's results to a text file for use with a main frame import file. The problem is with one of my formulas. Here it is (it's a bit long):

[tt]
numberVar NameLength := 30-length(trim({ARCUS.NAMECUST}));
numberVar Addr1Length := 30-length(trim({ARCUS.TEXTSTRE1}));
numberVar Addr2Length := 30-length(trim({ARCUS.TEXTSTRE2}));
numberVar CityLength := 17-length(trim({ARCUS.NAMECITY}));
numberVar PostalLength := 9-length(trim({ARCUS.CODEPSTL}));
numberVar PhoneLength := 10-length(trim({ARCUS.TEXTPHON1}[1 to 10]));

if NameLength < 0 then NameLength := 0;
if Addr1Length < 0 then Addr1Length := 0;
if Addr2Length < 0 then Addr2Length := 0;
if CityLength < 0 then CityLength := 0;
if PostalLength < 0 then PostalLength := 0;
if PhoneLength < 0 then PhoneLength := 0;

'6105'+
' '+
'A'+
{@sCustNumber}+
trim({ARCUS.NAMECUST})+ReplicateString (' ', NameLength) +
trim({ARCUS.TEXTSTRE1})+ReplicateString (' ', Addr1Length)+
trim({ARCUS.TEXTSTRE2})+ReplicateString (' ',Addr2Length)+
trim({ARCUS.NAMECITY})+ReplicateString (&quot;&quot;,CityLength)+
{ARCUS.CODESTTE}[1 to 2]+
trim({ARCUS.CODEPSTL})+ReplicateString (' ', PostalLength)+
' '+
trim({ARCUS.TEXTPHON1}[1 to 10])+ReplicateString (' ', PhoneLength)
[/tt]

The purpose is to construct a string to be an exact number of characters long. It appears correctly on the screen. This used to work but now the client accesses the report through Citrix and it appears to not work. Crystal Info 7.

From my playing around I've found that the last part of the string it will export is up to trim({ARCUS.NAMECITY}). The formula won't export the ReplicateString part of the formula. If I comment out the replicate string on the same line of the formula I can export more of the string - up to about the first two characters of the phone number.

I've tried changing the font of the field from Arial 10pt down to 6pt, changing the font to courier. The report is set to 'print' landscape and the field is as wide as the paper.

Any suggestions?

DjangMan
 
if it appears correctly on the screen then there is nothing the matter with the formula or the screen setup.

frankly I don't think the size of the field on the report really matters...I quish mine down to 2 gridsnaps when I export to excel so that each field gets its own column with no empty columns in between

Anyways...What method are you using for export?? I have had my best luck using Character Separated Values which you would choose the appropriate separator(in your case maybe you want NULL and appropriate delimiter

jim
 
I'm exporting using the Text format because I have to conform to a fixed format. I'll experiment with the CSV format. When I tried that and removed the delimiters I got a quote at the beginning and ending of each exported line which is technically correct but I don't have that flexibility in my export layout.

Thanks for the suggestion!

DjangMan
 
try using Character Separated Values for the export...it is a .chr file extension but you can change it to .txt.

It is a flat text format and for my money is the best text exporting format for Crystal
 
Thanks Jim,

I used the CSV format, removed the delimiters and that got me 90%. I had to add a CHR(13)+CHR(10) to the end of my group header record but otherwise things are looking good! :-D

DjangMan
 
Hi, just for info...

local stringvar delim = &quot;*&quot;;
'6105'+delim+
'A'+delim+
left({ARCUS.NAMECUST})+space(30),30)+delim+
left({ARCUS.TEXTSTRE1}+space(30),30)+delim+
left({ARCUS.TEXTSTRE2}+space(30),30)+delim+
left({ARCUS.NAMECITY}+space(17),17)+delim+
left({ARCUS.CODEPSTL}+space(9),9)+delim+
left({ARCUS.TEXTPHON1}+space(10),10)

would create a fixed length, * separated output file
for export as text or for input to Excel,etc

You could substitute delim = &quot;*&quot; with delim = &quot;,&quot; for csv
or delim = &quot; &quot; to separate all field with at least two spaces

Hth,
Geoff

Maybe a bit late !!
 
Hi, just for info...

local stringvar delim = &quot;*&quot;;
'6105'+delim+
'A'+delim+
left({ARCUS.NAMECUST})+space(30),30)+delim+
left({ARCUS.TEXTSTRE1}+space(30),30)+delim+
left({ARCUS.TEXTSTRE2}+space(30),30)+delim+
left({ARCUS.NAMECITY} +space(17),17)+delim+
left({ARCUS.CODEPSTL} +space( 9), 9)+delim+
left({ARCUS.TEXTPHON1}+space(10),10)

would create a fixed length, * separated output file
for export as text or for input to Excel,etc

You could substitute delim = &quot;*&quot; with delim = &quot;,&quot; for csv
or delim = &quot; &quot; to separate all field with at least two spaces.

Hth,
Geoff

Maybe a bit late !!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top