Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XLS import different between 2.6 and VFP 7?
Message
From
02/05/2006 12:52:10
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
XLS import different between 2.6 and VFP 7?
Environment versions
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01118465
Message ID:
01118465
Views:
56
Hi Foxperts

A bit tricky this. My program takes an Excel 3 spreadsheet and converts it to a FPD2.6 table, in FPD.

First the XLS is IMPORTed to an intermediary table where the data types of the fields can't be determined from the original spreadsheet. I don't understand what mechanism governs this but it doesn't seem to be consistant with the cell formats (besides, there are column header text cells above numeric or char data in the sheet).

Anyway, in development I ascertained the field types of the inter. table (with fields named after the XLS column letters), so that I could convert them as appropriate into the final table, thus:
Scan
  Scatter MEMVAR
  Select DestFB1
  Append Blank 
  
* These are S/S col heads->field names
* ____________________________________
  Replace Operator	 with tnOperator, ;	
          Journey	 with VAL( m.B), ;	
  	 Route	 with PADL( ALLTRIM( m.E), 4, "0");
  	 Date	 with CTOD( m.H), ;
  	 Class	 with PADL( ALLTRIM( STR( m.K, 4)), 4, "0"), ;
  	 TickTime with m.M, ;
  	 Number	 with VAL( m.O), ;
  	 Fare	 with VAL( m.R), ;
  	 Value	 with VAL( m.T) * 100, ;
  	 OStage	 with PADL( ALLTRIM( m.W), 4, "0");
  	 DStage	 with PADL( ALLTRIM( m.Y), 4, "0");
  	 Driver	 with VAL( m.Aa), ;
  	 Bus	 with VAL( m.Ac), ;
  	 Duty	 with VAL( m.Ae)
EndScan
Now I use the convenience of VFP and its debugger to test run this and it works fine. Then I rebuild the FPD project and produce a new exe. But when I run the exe I get a data type m/m on the above replace line.

OK I know I can isolate each field with its own replace, and that will tell me which one if fails on (which I've already done to perfect the code) but that doesn't stop the fact that at least one of the fields seems to give a different data type whether in VFP or FPD.

I'm using FPD tables that don't get converted to VFP

Any experience/knowledge/advice etc. on this?

'ppreciate it

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Next
Reply
Map
View

Click here to load this message in the networking platform