Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Russell Hill
  Where is Russell Hill?
 Sydney
 Australia
 Russell Hill
 To: Cyril Baskir
  Where is Cyril Baskir?
 
 Australia
 Cyril Baskir
 Tags
Subject: RE: Alternative to import data
Thread ID: 228838 Message ID: 228846 # Views: 6 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: XML
Date: Friday, May 22, 2009 2:55:03 AM         
   


> In my application, a user can enter a value for an item, like this:
>
> Item : Temperature
> Date : 03/01/2009
> Value: 19.40
>
>
> The user can import this data from Excel.
>
>
>
> I would like to add flexibility so that, instead of forcing the user to create a spreadsheet in my format, the user can easily get the data from other applications.
>
> Should I be looking at XML for this? Or something else?
>
> Here is the structure of the two tables:
>
>
>
> The parent table has a list of names (e.g. Temperature, Weight, Height).
> The child table has a list of values for each measure (e.g. Temperature taken every month).
> I have never used XML before. Can you give me some ideas on how to do this?
>
> Cyril

If it's all VFP table based, you could use CURSORTOXML and XMLTOCURSOR to move data around.

The following is an example of the former.

SELECT TABLE1.CLIENTKEY, TABLE1.SOMEINFO, TABLE2.SOMEINFO ;
  FROM TABLE1 ;
  JOIN TABLE2 ;
    ON TABLE2.CLIENTKEY = TABLE1.CLIENTKEY ;
  INTO CURSOR XMLCursor
xml_file_name = 'C:\SOMEFOLDER\SOMEFILENAME.XML'
bytes_output = CURSORTOXML('XMLCursor',xml_file_name,2,8+512,0,'1')
IF bytes_output > 0
   MESSAGEBOX('The file ' + xml_file_name + ' has been successfully created.')
ELSE
   MESSAGEBOX('An attempt to create the file ' + xml_file_name + ' has been unsuccessful.')
ENDIF

Hope this gives you some ideas at least.

ENTIRE THREAD

Alternative to import data Posted by Cyril Baskir @ 5/22/2009 1:33:25 AM
RE: Alternative to import data Posted by Russell Hill @ 5/22/2009 2:55:03 AM