Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Record selection not working as expected Post Reply Post New Topic
Author Message
Freek
Newbie
Newbie
Avatar

Joined: 16 Dec 2009
Location: Netherlands
Online Status: Offline
Posts: 8
Quote Freek Replybullet Topic: Record selection not working as expected
     Posted: 17 Dec 2009 at 6:41am
Hi!

I'm trying to merge 2 reports that select records (relations from the CRM) from the same source into 1 report.

To do this i'm trying to combine the selection criteria from both reports into 1 formula. The problem is that I end up with more records in the combined report than the 2 separate reports together. This is strange, more over since there should be a slight overlap in the records selected in both original reports.

The selection criteria from report 1:
(
{ma01_org.type} = "o" and
{ma01_org.stat} <> "X" and
{ma01_org.markt-kd} < "9000" and
{ma01_org.markt-kd} > "0110" and
{ma01_org.markt-kd} <> "0120" and
(( isnull( {ma02.uit-dienst}) ) or ( {ma02.uit-dienst} > today ))
) or
({ma08.selek-kd} in [3600 to 3632 ] or {ma08.selek-kd} in [3803 to 3803 ])

The criteria of report 2:
{ma01.mail-nr} in ["03886800", "07156600", "05850900", "04520800", "04250400", "05327500", "05500700", "04681600", "08779000", "04210000", "06934000", "05326600", "03896200", "04553600", "10319200"] and
( ( isnull({ma02.uit-dienst}) ) or ( {ma02.uit-dienst} > today ) )

The combined criteria:
((isnull({ma02.uit-dienst}) or {ma02.uit-dienst} > today)
AND
({ma08.selek-kd} in [3600 to 3632 ]
OR
{ma08.selek-kd} in [3803 to 3803 ]
OR
{ma01_org.mail-nr} in ["03886800", "03896200", "04210000", "04250400", "04520800", "04553600", "04681600", "05326600", "05327500", "05500700", "05850900", "06934000", "07156600", "08779000", "10319200"]
))
OR
(
{ma01_org.type} = "o" and
{ma01_org.stat} <> "X" and
{ma01_org.markt-kd} < "9000" and
{ma01_org.markt-kd} > "0110" and
{ma01_org.markt-kd} <> "0120"
)

Do any of you see any way this could end up selecting more records than reports 1 and 2 combined?
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 17 Dec 2009 at 7:26am
Likely it is because you have broken up your 2 statements. I see that they shared a common element and that is waht you tried to add in but your combined statement has the last section as a stand alone OR
(
{ma01_org.type} = "o" and
{ma01_org.stat} <> "X" and
{ma01_org.markt-kd} < "9000" and
{ma01_org.markt-kd} > "0110" and
{ma01_org.markt-kd} <> "0120"
)

and it is not using the other critieria
(( isnull( {ma02.uit-dienst}) ) or ( {ma02.uit-dienst} > today ))
) or
({ma08.selek-kd} in [3600 to 3632 ] or {ma08.selek-kd} in [3803 to 3803 ])
IP IP Logged
Freek
Newbie
Newbie
Avatar

Joined: 16 Dec 2009
Location: Netherlands
Online Status: Offline
Posts: 8
Quote Freek Replybullet Posted: 17 Dec 2009 at 7:41am
Oh duh, how could i overlook that. Thanks, im gonna rewrite the statements.

I was starting to think there were secret options or behaviour to the selection criteria that were messing with me.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum