Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VFP, one-to-many write table problems

Posted on 2010-09-15
7
Medium Priority
?
494 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
[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
  • 3
  • 2
  • 2
7 Comments
 
LVL 30

Accepted Solution

by:
Olaf Doschke earned 2000 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 43

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
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.

 
LVL 30

Expert Comment

by:Olaf Doschke
ID: 33698946
pcelba,

an answer has already been given and accepted.

Bye, Olaf.
0
 
LVL 43

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 30

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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Let's take a look into the basics of ransomware—how it spreads, how it can hurt us, and why a disaster recovery plan is important.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

609 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