Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Parent Child reporting query
Message
De
26/09/2013 09:03:10
 
 
À
26/09/2013 08:54:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01584190
Message ID:
01584206
Vues:
35
>>>>I am trying to produce a report with a parent-child table involved. The parent table has a budget field and the child table has a series of entries under the budgeted item.
>>>>I want to be able to show the budget sum in the summary band; how do I get the report to take a single budget value? At the moment, whatever I do, I get the budget figure multiplied by the number of child entries. So, if I have a parent record with a budget figure of 5 with 3 supporting child entries, the total budget for the group is 15 when it should be 5.
>>>
>>>If the value you want is in the parent table, just reference the parent table field with no calculation.
>>>
>>>Tamar
>>I have tried that - by setting up a relationship from the child table back to the parent table, but am still getting the multiple values. Ideally I wanted the parent (budget) figure to appear on the first line of the group but I assumed this was the reason it was picking it up multiple times as it was effectively being repeated each line; so I moved the parent value to the group header. The value in the summary band is then the SUM of the parent values - but I am still getting multiple values.
>
>The problem is the direction of your relation. Set the relation from the parent to the child.
>
>FWIW, I never use relations for anything other than displaying data on my desktop. For a report, I always use a query to put the report data into a cursor and report from that.
>
>Tamar
Actually, this is the first time I have tried to do a report using parent-child relationships as I too have always put the data into a cursor - but on this occasion the cursor has the parent budget figure against each detail line (the cursor having multiple rows for each parent record). Hence my issue with the multiple values coming through from the parent table. I thought I would get round it by trying the parent-child direct reporting process.
As a matter of interest, given that I have the multiple lines in my cursor for reporting, how would I get the sum of only one of the budget values per parent group? I can resort to running through the cursor before hand and removing duplicate values I guess - but it seems a bit of a fudge.

Barry.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform