Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel date field to Visual FoxPro
Message
From
16/10/1998 22:15:58
 
 
To
16/10/1998 11:33:38
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00147517
Message ID:
00147747
Views:
30
>From Excel, a date field has been converted to a numeric value after the import.
>
>So, a date like 1/12/1999 could give a value like 35827. Some other fields gave something like 35957.50841435185. Is there a simple formula to reverse that to the date value?




well, I use a tmp table to import excel file.
and use a simple numeric field to carry 35827 or sth like that.

That take a benefit that I don't need to use the import wiz.!
This save 70% of time to assign corresponding field because go ahead copy, insert, append, replace within VFP table is much easy!

What you need to do:
Make a new im_tmp with the exact structure of excel file.
(Remember to use numeric field to carry date value!)
and add some more date field at the end of table!
then, one line command:

Import from myExcel.xls type xl5 && it will import all without using wiz!

UPDATE IM_tmp ;
SET MyDATE= IIF(EMPTY(MyDateNUM), {}, {1900/01/01} + MyDateNUM -2 ) ;
Where .t.

Then, use the original table and append from this im_tmp file!
Since VFP will corresponding copy the data with same field name,
you don't need to care where is the field order to put in im_tmp.

then, you can simply make this with easy!

Use MyVFPTable excl
*Zap && optional if you need to do overall replacement!
Append from im_tmp

That's all, you can make a simple proc to do, it will cost very short time to do all import works!

myImport() && That's finish! ^-^;
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Previous
Reply
Map
View

Click here to load this message in the networking platform