break table into files vfp

Hi: I have a table called batches. This comprises several batches, and all the appropriate data, and changes every time  I populate it.
I need to be able to export the table - broken into batches - into a series of text files, each given the name of the batch.
So something like "for every batch, copy all data in the table to a file called (name of batch).txt."

Is this something that is feasible?

Thanks!
Richard TeasdaleFinancial ControllerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pcelbaCommented:
What would help is the table structure and some info how to recognize different batches. The rest is then simple...

Remember you can write simple command:

SELECT * FROM YourTable WHERE batch = SomeBatch TO FILE ("SomeBatch.txt")

which is probably not exactly the result you need but a good start at least...

To do it for all batches in your table you may place above command into a loop:

SELECT DISTINCT batch FROM YourTable INTO CURSOR cBatches
SCAN ALL
  lcBatch = TRIM(batch)
  SELECT * FROM YourTable WHERE batch = m.lcBatch TO FILE (m.lcBatch+".txt")
ENDSCAN

etc.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard TeasdaleFinancial ControllerAuthor Commented:
Thanks as ever, pcelba! I can take it from here, thank you very much.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.