How to avoid the duplicate values?

2019-03-06 03:05发布

Using Crystal Report 8.5

Example

Personid Date

3100   22-02-2009
3100   22-02-2009
3100   22-02-2009
3200   22-02-2009
3200   22-02-2009
3200   22-02-2009
3200   22-02-2009
3100   23-02-2009
3100   23-02-2009
3100   23-02-2009
3100   23-02-2009
3200   23-02-2009
3200   23-02-2009
3200   23-02-2009
3200   23-02-2009

So on…,

Expeceted Output

Personid Date

3100 22-02-2009
3100 23-02-2009
3200 22-02-2009
3200 23-02-2009

So on…,

Date should appear only once for the personid. But I am getting duplicate record from the database. Date is displaying again and again for the personid.

How to skip the duplicate record. Can any one help to solve this problem.

Need crystal report Formula Help.

3条回答
冷血范
2楼-- · 2019-03-06 03:36

Use This Steps......

1) Right click on the field, and select the “Format Field” menu.

2) Tick the Box that says: Suppress if duplicated

http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=11435

http://www.crystalreportsbook.com/Forum/forum_posts.asp?TID=8908

查看更多
Explosion°爆炸
3楼-- · 2019-03-06 03:37

i haven't worked for long time with crystal reports but try one of two things First and better is to use some kind Group By or Distinct in your query.Beside solving this problem it also makes the report run faster because it won't render so many duplicated data. Second thing( i am not shure about it ) but i think there was a propraty Suppres Duplicate Best Regards, Iordan

查看更多
叼着烟拽天下
4楼-- · 2019-03-06 03:39

You should be able to group by PersonID and then by Date, move the fields from the details section to the Date group footer and then suppress the Details, PersonID Header and Footer, and Date Header so that the Date Footer works as your details row. Doing this will only show one row for each PersonID and Date combination. Hope that helps.

Edit: Each group header and footer only displays once for each change of the value. Therefore in your example if you didn't suppress any sections you'd have something like the following:

GH1 - 3100
  GH2 - 22-02-2009
      D - 3100   22-02-2009
      D - 3100   22-02-2009
  GF2 - 22-02-2009
  GH2 - 23-02-2009
      D - 3100   23-02-2009
      D - 3100   23-02-2009
      D - 3100   23-02-2009
      D - 3100   23-02-2009
  GF2 - 23-02-2009
GF1 - 3100
GH1 - 3200
  GH2 - 22-02-2009
      D - 3200   22-02-2009
      D - 3200   22-02-2009
      D - 3200   22-02-2009
      D - 3200   22-02-2009
  GF2 - 22-02-2009
  GH2 - 23-02-2009
      D - 3200   23-02-2009
      D - 3200   23-02-2009
      D - 3200   23-02-2009
      D - 3200   23-02-2009
  GF2 - 23-02-2009
GF1 - 3200

Therfore if you hide all of the sections except for the GF2 sections you'd get:

  GF2 - 3100   22-02-2009
  GF2 - 3100   23-02-2009
  GF2 - 3200   22-02-2009
  GF2 - 3200   23-02-2009
查看更多
登录 后发表回答