Summing up values
Hi list,
I have two result sets.
One returns me some information about an employee resusulting in 3 rows,
which is correct.
The second sums up the money an employee earned per month, which returns
one row, which is correct.
Let's assume the employee is John Doe and has 3 days of vacancy this
month, then the first result looks like the following:
Employee; VacancySta; VacancyEnd
John Doe; 01.05.2008; 05.08.2008
John Doe; 19.05.2008; 20.05.2008
John Doe; 26.05.2008; 28.05.2008
The second query gives me the money John Doe earned, like the following:
Employee; Money
John Doe; 1000,-
The money John Doe earned this month is summed up over all days, he may
have a 40-hour week which would result in 8 hours from Monday to Friday,
but it could be that he works on Saturday too, so 8 hours from Monday to
Thursday and 4 hours for Friday and Saturday, etc. so the sum is necessary.
Both results give me the correct values, but if I join them, I get 3.000,-
for John Doe. It seems that the report engines first joins and then
calculates the sum.
Is there any possibility to work around that problem?
--- posted by geoForum on http://delphi.newswhat.com
I have two result sets.
One returns me some information about an employee resusulting in 3 rows,
which is correct.
The second sums up the money an employee earned per month, which returns
one row, which is correct.
Let's assume the employee is John Doe and has 3 days of vacancy this
month, then the first result looks like the following:
Employee; VacancySta; VacancyEnd
John Doe; 01.05.2008; 05.08.2008
John Doe; 19.05.2008; 20.05.2008
John Doe; 26.05.2008; 28.05.2008
The second query gives me the money John Doe earned, like the following:
Employee; Money
John Doe; 1000,-
The money John Doe earned this month is summed up over all days, he may
have a 40-hour week which would result in 8 hours from Monday to Friday,
but it could be that he works on Saturday too, so 8 hours from Monday to
Thursday and 4 hours for Friday and Saturday, etc. so the sum is necessary.
Both results give me the correct values, but if I join them, I get 3.000,-
for John Doe. It seems that the report engines first joins and then
calculates the sum.
Is there any possibility to work around that problem?
--- posted by geoForum on http://delphi.newswhat.com
This discussion has been closed.
Comments
For future reference please use your real name when posting to these
newsgroups.
The issue with using the visual linking in your case is that behind the
scenes ReportBuilder is performing everything in a single query (joining the
two datasets then calculating the sum as you mentioned).
One workaround would be to link the datasets manually. Anther would be to
create another dataset that creates a sum for each distinct record returned
in the first dataset.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I'm sorry about that, I just forgot to add my name, because I'm writing
this on the delphi.newswhat.com website and not via email tool.
Those two approaches sound good, especially the first one. Could you
please explain how I can do that or is this explained in the documentation
and I just overread it?
Kind regards,
Christoph
--- posted by geoForum on http://delphi.newswhat.com
Sorry for the confusion, I meant perhaps changing your posting name from
baka0815 to Christoph .
Take a look at the following example on how to link DADE pipelines.
http://www.digital-metaphors.com/tips/LinkDADEPipelines.zip
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
No problem, I just saw that other people post using their nick names only
and I'm so used to use this nick online, that I didn't thought of a
problem there.
Thank you for the link and the Delphi example inside, but the way our
reporting is built, we have no possibility to use specialised code for any
report but need to do any report-specifiy inside the report (using SQL and
RAP).
There isn't a solution using RAP I guess?!
Kind regards,
Christoph
--- posted by geoForum on http://delphi.newswhat.com
Hmm...
I'm posting using newswhat.com and just changed my nickname there. Looks
like it has no effect changing the nick afterwards...
--- posted by geoForum on http://delphi.newswhat.com
Though the TppMasterFieldLink class is not natively included in RAP, it is
possible to access it using a RAP pass-thru function. Examples of RAP pass
thru functions can be found in the RAP demos located in the
\RBuilder\Demos\0. RAP\... directory.
It may also be possible to add and register an RTTI class for the
TppMasterFieldLink class giving you access to its routines. Examples of
this can be found all over the RB source.
Adding this to RAP is something we will consider for a later release.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
thanks for the info. I will give it a try and report back if that worked.
Regards,
Christoph
--- posted by geoForum on http://delphi.newswhat.com