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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strings Being Interpreted As Numbers At Runtime

Status
Not open for further replies.

alhamil5

Programmer
Feb 20, 2003
19
US
At runtime, fields I have defined as type String in my .ttx file are being interpreted as type Number when the .csv source data file is opened and passed to Crystal. In the report designer, all the fields for my report are listed as type String, which is correct. But when I run the report, it seems like some kind of decision is being made about how to interpret each column's data type based on the data in it - if a given column has mostly numeric data, the report seems to 'decide' that the data type is numeric and it won't display or print any data fields that contain non-numeric characters in that column. I'm at wit's end with this; I've tried surrounding every data item with double quotes to FORCE the report to read every field as a String, but even that doesn't work. I've tried deleting and rebuilding my .ttx file and even deleting and rebuilding my .rpt file, but again, nothing works. Does anyone have any suggestions for how I can force Crystal to read every field in my .csv file as a String?
 
I'm not familiar with this example, but there's a similar concern with Excel files.

The cheat is to seed the first column in the file with a string value for each field, and then filter it out in the report.

-k kai@informeddatadecisions.com
 
Thanks Kai, but it's not working. I used the word "string" to seed my first row, but it doesn't seem to make any difference. When I run the report without filtering out the seed row, nothing prints in columns that have predominantly numeric data, even in the seed row. Any other ideas?
 
Maybe this will help...here's an excerpt from my source data. If I delete the last row in this excerpt, the report runs fine and everything comes into the report as a string. But if I include the last row, any column that has more numbers than letters in it is interpreted as Number and text entries won't print in those columns. I don't see what's so different about that last row; maybe someone else can?

RECORD NO,DASH#,ITEM#,IS PART NUMBER,WAS PART NUMBER,IS DESCRIPTION,WAS DESCRIPTION,IS QTY,WAS QTY,IS REF_DES,WAS REF_DES,IS NOTES,WAS NOTES,IS ZONE,WAS ZONE,IS REF SPEC,WAS REF SPEC
string,string,string,string,string,string,string,string,string,string,string,string,string,string,string,string,string
1,ALL,18,**DELETED**,RV061-9000-000,,MANUFACTURING WORKMANSHIP MANUAL,,REF,,-,,-,,-,,-
2,ALL,33,NA,NA,NA,NA,NA,NA,P15,NA,NA,NA,NA,NA,NA,NA
3,-001,6,**DELETED**,1302160-104,,"CIRCUIT CARD ASSEMBLY (CCA) LCD MONITOR",,1,,-,,-,,-,,-
4,-001,22,1306583-002,1302160-101,"CIRCUIT CARD ASSEMBLY (CCA), LCD MONITOR","CIRCUIT CARD ASSEMBLY (CCA), LCD MONITOR",-,-,-,-,-,-,-,-,-,-
5,-001,27,-,-,-,-,7,8,"R1, 18, 22, 25-28","R1, 18, 22, 25-28",-,-,-,-,-,-
 
I solved my problem; I imported my .csv file into MS Access 2000, then exported it back out to .csv. Using the newly exported .csv, everything ran fine. Weird. The only difference I could see between the new export and my original .csv file was that the new export surrounded every field value with double quotes, but I'd tried that solution previously by manually typing in all the double quotes, so I don't know why it's working now.

Also note, it still works even after I remove the "seed" row.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top