[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

VFP, Append Grid data to a table

Posted on 2010-08-20
3
Medium Priority
?
1,450 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
jrbbldr earned 2000 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 30

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 30

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
With its various features, Office 365 can not only help you with your day-to-day business tasks, it can also do wonders for your marketing campaign.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

650 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