GROUP BY and SUM at Crystal Report

Asked

Viewed 1,710 times

1

I need to do something relatively simple with Crystal Report but I’m not getting it.

I have a report like this:

OP   |    CLIENTE   |   PREÇO
1          João          10
1          João          20
1          João          30
2         Marcelo        15
3         Rodrigo        35 
3         Rodrigo        15
4         Pâmela         27

And I’d like you to show up like this:

OP   |    CLIENTE   |   PREÇO
1          João          60
2         Marcelo        15
3         Rodrigo        50 
4         Pâmela         27

That is, group by Ops and add up the prices.

How do I do that??

  • What is the report data source ? A query with group by solves this.

  • Yes, actually it would be even simpler to do with the query, but I’m assembling the whole report with the UI of Crystal Report for Visual Studio and would like to know how to do exactly this through it.

  • @Cassiomilanelo There actually is. In the place where you select the data source, you should probably be selecting some table. Previously make a VIEW in the database and point to it.

1 answer

1

One way to do it in the Cor is :

Enter a Group CLIENT

Enter the field of the name of Client

Enter the lines of detail

Ins1ra a Total (Button "sum" - Inseir Summary) , totals by group of the CLIENT

Place the detail line as Hide (Right mouse button - Hide Detailed Search)

  • Thanks for the Motta tip! It really works that way, but wouldn’t there be a more practical way? In the example I gave it is easy, but the report I’m putting together is much bigger than this, it would be more labor and nothing manipulable, not counting the infinity of sections that he adds...

  • It does not occur to me , but the best way would be via sql com group by even CR would use an SQL , a view or a precedent returning cursor.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.