Search code examples
sql-servercrystal-reports

Duplicate records after Section Expert activation


Something weird (or maybe not that weird) happened today when trying to finish this report, report I was supposed to handle to the client today. Regardless

I have created two detailed sections with suppression rules.

section A has IF {ELEC_.SIEGE_HR} = "0" THEN FALSE ELSE TRUE /*only records with siege_hr =0 will be shown*/

section B has IF {ELEC_.SIEGE_HR} = "1" AND {ELEC_ENQUETES2.FLG_SIEGE}="0" THEN FALSE ELSE TRUE /*only records with siege_hr =1 and FLG_SIEGE=0 will be shown*/

Put separately, section A shows me 10897 records and section B shows me 2208 records. Each section brings unique records. When combine , the records should be still unique and gives me the sum of the records from the 2 sections e.g 13102.

Yet, when I'm running the report with the 2 sections , I have duplicate records, close to a thousand, which gives me in total 14015 records.

I made sure to select in the database tab , distinct records only ... to no avail.

I'm slowly but certainly losing my sanity ...

Any insights are welcomed


Solution

  • I managed to find out the solution , thanks to @cojimarmiami

    I added an extra condition on both detailed sections , AND {ELEC_.FLG_SIEGE} ="1" for details A and AND {ELEC_.FLG_SIEGE}<>"1"for details B.

    Which gives this

    Details A

    IF {ELEC_.SIEGE_HR} = "0" AND {ELEC_.FLG_SIEGE} ="1" THEN FALSE ELSE TRUE //(for details A)
    

    Details B

    IF {ELEC_.SIEGE_HR} = "1" AND {ELEC_.FLG_SIEGE}<>"1" THEN FALSE ELSE TRUE //(for details B)