Solved

VFP, one-to-many write table problems

Posted on 2010-09-15
7
433 Views
Last Modified: 2012-05-10
I'm working in VFP 9.0 SP2.  I have a one-to-many program which is writting blanks fields for the many items into the one table. I have two tables:  

table "ORDERS" which holds the customer info.

table "ITEMS"  which holds the item info.

When I go to save the information I  SELECT ORDERS, find & increment the last order number and append a record with the customer data.

Then I  SELECT  ITEMS  and append the items info using this code.

IF !USED('ITEMS')
     USE ITEMS IN 0
ENDIF
SELECT ITEMS
APPEND FROM   DBF('ITEM LIST')   FOR   !EMPTY(ITEM_LIST.part_no)
SELECT 0

In the ORDERS table I am see the first row filled with the correct customer info. and I have additional rows filled with ***************** for each of the items. I was expecting to see only one row entry for each order in the ORDERS table.  It is acting like the tables are linked, but I am working with them individually.

If I have four items in an order the ORDERS table looks like this:

cust_name    |   cust_add     | cust_phone   | ......
****************|******************|*****************|........
****************|******************|*****************|  .........
****************|******************|*****************|  ..........

0
Comment
Question by:jws2bay
  • 3
  • 2
  • 2
7 Comments
 
LVL 29

Accepted Solution

by:
Olaf Doschke earned 500 total points
ID: 33684563
You see such linked tables and *** for the parent records, if SET SKIP is set. As there is only one order item you only see one row filled with it other rows are filled with *** as placeholder.

Bye, Olaf.
0
 

Author Comment

by:jws2bay
ID: 33685228
Olaf

Thanks for the help
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33696939
jws2bay, I don't know why you are not patient enough to wait for an answer to your question...

This is just a brief list of possibilities how to solve your one to may report problem.

You have several options one of them is to create the report for Ordered_items table and establish a relation from ordered_items to Customer. The report should have group band for Customer data and detail band for Ordered_items data:

SELECT 0
USE Customer ORDER TAG web_order
SELECT 0
USE Ordered_items ORDER TAG web_order

SET RELATION TO web_order INTO Customer

REPORT FORM YourReport ...

Another possibility is to create a query

SELECT * FROM Customer, Ordered_items ;
  WHERE Customer.web_order = Ordered_items.web_order ;
  INTO CURSOR ...

Above query creates two differently named columns for web_order. So, you probably should use a slightly modified report.

The view usage is similar to the query.

The last option could be e.g. Report Wizard which will allow to create the report in a minute including all relations.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33698946
pcelba,

an answer has already been given and accepted.

Bye, Olaf.
0
 
LVL 41

Expert Comment

by:pcelba
ID: 33701179
Sorry Olaf, this is nothing against you and no correction to your answer. Your answer is perfect and points were assigned correctly.

My last post here was a reaction to another already deleted question...

jws2bay's speciality is to ask a question, wait one hour, and delete the question just in the time when I am working on the answer, testing it etc. I have to stop doing such mistakes...

But if the answer is already created why to put it into the trash? So, I've posted it here.

 
0
 

Author Comment

by:jws2bay
ID: 33705986
pcelba,

Sorry, I was quick on the draw.  I can understand the frustration of composing the answer and then not having the chance for it to be considered.

I had not considered putting the report together with the Customer as the group band, and the item data in the detail band. I'll have to try this out.

Thanks for the answer.
0
 
LVL 29

Expert Comment

by:Olaf Doschke
ID: 33707879
I see, haven't seen the other question at all.

I also tend to create and test samples, but lately also often keep it at pointing to the reason, often that's sufficient already.

Bye, Olaf.  
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

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…
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

19 Experts available now in Live!

Get 1:1 Help Now