I am trying to create a VFP 6 program that list all CSV files in a location. All CSV Files are updated daily. All CSV Files are named by building, date, and time, for example, 90_2014-9-17_9-10. Also, there are three digit buildings like 100_2014-9-17_9-29. I want the user to select a csv file, and once the csv file is selected, the building and date are appended along with the cursor MyResults fields Fb and Fc to the VFP Ltable. After the cursor NewBatch is created, you can get the building number from Row 2 Column Fb. The date is appended as mdy. Once I get the cursor MyResults, how can I alter cursor MyResults to match VFP Ltable structure to append the Fb and Fc data?
Here is my code:
SET DEFAULT TO H:\OBRA\LDY\SORTREPORTS\
CSVsheet = getfile(",CSV")
NEWFILE = (CSVSHEET)
MESSAGEBOX("FILE NAME IS "+ALLTRIM(NEWFILE),0, "NAME OF IMPORT CSV")
&&&& CSV START
SET SAFETY OFF
THISDOC = "H:\OBRA\LDY\SORTREPORTS\FILENAME.CSV"
CREATE CURSOR NEWBATCH;
(FA N(2), FB N(5), FC C(15))
APPEND FROM &CSVSHEET DELIMITED
&& APPEND FROM H:\OBRA\LDY\SORTREPORTS\FILENAME.CSV] DELIMITED
SELECT * FROM NEWBATCH WHERE FA > 0 INTO CURSOR MyResults
Please check the attached file to understand the question.
Each Fb data will need to be appended and multiplied by the appropriate pd field in the Ltable for each Fc data. For example of Fc(Blankets) and Fb(5), Blankets would be appended in the Ltable field called Blktdescript,, 5 would be appended in the Ltable field called blktamtin, than the blktamtin would need to be multiplied by Ltable field called blktpd to get amount for Ltable field blktpdin. Each Fc and Fb fields would need be done the same. Check the attached file.