Lets say that I have this records in a dataset:
name1 XXXXX XXXXXX
name1 XXXXX XXXXXX
name1 XXXXX XXXXXX
name2 XXXXX XXXXXX
name2 XXXXX XXXXXX
name2 XXXXX XXXXXX
name2 XXXXX XXXXXX
I want to create a report where i can see the sum/count of records in each names:
name1 3
name2 4
How can I achieve this output? Additionally, is it possible to assign a bound field in a crystal report from a query? For example:
select name, count(name) as [Count] from tbname group by name
How can I get the Count开发者_如何学编程 field? (if it's really not a field in a table)?
If you go to insert -> summary. From there you can select which field you want a sum for. Then under "Calculate Field" select count. The "Summary Location" is up to you, I prefer to put it under the group (if I have one). When you see your details page, you will see a new "field" or box that will contain your information. If you would like to also have a grand total, you can copy and paste that box into the report footer and CR will automatically add them all up for you.
Also, say you want to just see the total, you don't want to see all the other stuff: right click the field you don't want to see -> Format Field -> Common -> click Suppress. That way you wont see the information, but its still there for CR to calculate.
As for putting a parameter for that box, it may populate as a choice as the fields do. I'm not sure, never tried it. Hope this was helpful!
u try insert goup for (table.name) and then insert summary and choose the field to summarize, and then choose Distinct Count to calculate this summary in the footer.
精彩评论