Solved

VFP, Append Grid data to a table

Posted on 2010-08-20
3
1,331 Views
Last Modified: 2012-05-10
Working with VFP 9.0 SP2.  

I am working with a web store where I am downloading store orders.  I have a one-to-many relation. One order/customer info. to many items purchased.  I have a filtered the remote view  into a cursor of the items purchased, and have a grid populated from the cursor.   What is the best way to save the grid data, or cursor into a VFP table?   I'm not sure because it is the multiple records.

Thanks
0
Comment
Question by:jws2bay
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
jrbbldr earned 500 total points
ID: 33489392
Assuming you have a Grid Cursor (perhaps aliased as GridCursor)
And assuming that you want the data to go into MyTable which has the exact same field structure
And assuming that there is at least one field (DesirdFld) which can be used to differentiate empty records from non-empty records.....
IF !USED('MyTable')   USE MyTable IN 0ENDIFSELECT MyTableAPPEND FROM DBF('GridCursor') FOR !EMPTY(DesirdFld)
NOTE - If the GridCursor and MyTable have different structures and/or need to be handled in some different manner (for example: say you want the Grid data into 2 separate VFP tables), then you will need to use another approach.   But you haven't told us enough to determine if that is necessary.

Good Luck
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33490906
If you'd use the remote instead of copying to a secondary cursor to display the items, then you TABLEUPATE(.T.) to update all rows of the view at once. You need an updatable view of course.

Instead of filtering all items of all orders of all customers perhaps, you parameterise the remote view to only retrieve the items of a single order in the first place.

Bye, Olaf.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33490936
Besides that, if you really want a local copy of order data and not update the web backend, you can use append to a local table, true. You could also COPY TO a new dbf to create a local table with exact same structure in the first place.

Select alias
COPY TO mytable.dbf DATABASE somedbc

You'd only need to do this once, if some.dbf doesn't exist already, and afterwards would use the code of jrbbldr. Both COPY TO and APPEND do respect the filter setting on the grid cursor, you only ned the FOR clause to apply further filtering.

Bye, Olaf.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Microsoft Visual FoxPro (short VFP) is a programming language with it’s own IDE and database, ranking somewhat between Access and VB.NET + SQL Server (Express). Product Description: http://msdn.microsoft.com/en-us/vfoxpro/default.aspx (http://msd…
What is Backup? Backup software creates one or more copies of the data on your digital devices in case your original data is lost or damaged. Different backup solutions protect different kinds of data and different combinations of devices. For e…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now