Solved

VFP, Append Grid data to a table

Posted on 2010-08-20
3
1,377 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 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Dynamic rowheight in Foxpro grid 8 359
Calling the Excel .OPENTEXT() method from with VFP 12 1,092
break table into files vfp 2 116
FoxPro comparing columns 2 99
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…
In order to fulfill our mission of inspiring learning in the technology community, Experts Exchange is launching a Course of the Month program. Premium and Team Account members will have access to one course per month as a part of their membership, …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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