Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with one to many report
Message
From
03/06/2004 10:16:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
03/06/2004 09:58:30
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00909492
Message ID:
00909551
Views:
6
This message has been marked as the solution to the initial question of the thread.
>Hello Hilmar!
>Thank you for answer.
>For example in report:
>
>BADGE NAME_p SUM_P NAME_C < = name of fields.(badge,name_p,sum_p - fields of Parent table; name_c - field of chield table )
>
> 1 name_parent001 10 name_chield_001
> name_chield_002
> name_chield_003
> 2 name_parent002 31 name_chield_004
>
> summary 61 (! wrong!!! Must be 41)
>

So, it looks as if it is summing once for every child, but you want it once for every parent.

Are you printing all the children, or only once per parent?

Anyway. One way to solve this is to prepare all the data before running the report.

Another way is to count the records per child, reset when the parent changes, and only add when the record count = 1.

That is, create a report variable, countchild, set calculation to "count", and reset it to zero when the parent changes. This should make countchild = 1 for the first child in a group, 2 for the second, etc.

Then, create a variable for the total, and in the expression to be summed, write: iif(countchild=1, sum_p, 0).

This will only add the first record in each group; it seems to me that this is what you want.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform