Crystal reports Count group by - crystal-reports

I am very new to Crystal reports and I am working on fixing an existing report.
I am having an issue with a simple function, I am attempting to count the number of patients for each provider. I am connecting to EPIC Clarity database, if that helps. When I use the following, I am expecting to get a count of the patients (based on the number of PAT_ID, A unique field ) , grouped by the PROV_ID (also a unique field) count({PATIENT.PAT_ID},{CLARITY_SER.PROV_ID})
This results in the error: There must be a group that matches this field.
I am not sure what this error is trying to tell me. I have never used crystal reports before and I am not sure where to begin. any help is appreciated.

Related

Crystal Report create separate report pages based on field value change

Looking for some advice related to data grouping and printing in Crystal Reports.
I'm working with an order confirmation form. Ideally I would create separate report pages based on a specific field value change for the 'warehouse' field. So, if any given line on an order comes from warehouse A, it prints together. Then we'd get a page break, and we'd see the form repeat for any lines coming from warehouse B.
I've inserted a new group for "warehouse" and configured the group as 'New Page Before.' But when I attempt to print I'm getting an error related to "There must be a group that matches this field". So there must be some pre-existing grouping that I'm not considering. I'm hopeful I can figure this out.
I am interested to get thoughts on overall design, and if the grouping approach I am trying to take is even the correct one.
Somewhere in your report you probably have a formula such as:
Sum({some_value}, {some_field})
where the {some_field} used to be -- but is no longer -- grouped upon.
Fix that expression to set the desired aggregation level (the 2nd argument) to a field you are actually grouping on.

How do i select records of crystal subreports dynamically

Good people of stack overflow.
I am stuck on this one.my crystal report is using a joined query
str = "SELECT invoices.voucher,
invoices.customer_name,invoice_details.item_name,
invoice_details.Amount FROM invoices
LEFT OUTER JOIN invoice_details
ON invoices.voucher =invoice_details.voucher "
The crystal report is grouped by voucher and the details are placed on detail section of group details to display item name and item amount.
It is working perfectly in design.
However at run time in VBNET when i select exactly the same query i get repeating line items. Example if the invoice items in invoice_details table were three in my report the three items will be repeated three times.
I have checked all over the internet for the same complain. No luck.
Someone suggested "suppress if duplicate" on an item with unique number such as voucher number. I did not get success.
Has someone met this difficulty and can you suggest how to resolve this?
If it can be of help to someone else...
My difficulty in duplicating line items was coming from using two tables, invoices and invoice_details when designing the crystal report.
And then using the link feature at crystal report design.
I had not realized i ought to have designed crystal report using a stored view (access query from the database). While using the stored view i did not do any linking at designing report but used grouping expert to group by invoice numbers.
So the report finally worked well after much frustration.

Crystal Reports - Using Report Data as Sql Command Parameter

I'm hoping someone here might be able to help me with a Crystal Reports problem that's been bugging me on and off for days.
I have a report that is used as a picking slip for our warehouse staff to tell them which products to pack for each order that comes through our sales system.
The report contains all the products for the order and the quantities that need to be packed in the details section of the report which come from a number of joined tables.
My problem is that I have to then query the database again in order to get the total amount of items for each product on the order that have been packed across all orders throughout the warehouse.
The report datasource only returns records relating to the order on the picking slip so I need a sub query.
I've tried to use a SQL command with the following query:
SELECT ISNULL(SUM(QtyPacked), 0)
FROM tblPackingSlipLines
WHERE Status = 'Packed'
AND ProductId = '[ProductId]'
I'm stuck on passing the product id into the command as it is held in a text field on the report itself which is populated from tblProducts.ProductId (one of the joined tables).
Is it even possible to access this value from the command?
I've tried things like ProductId = '{tblProducts.ProductId}', #ProductId, ?ProductId and numerous other weird and wonderful permutations.
I can't use a parameter as that would require either user interaction; not possible as the report is auto generated by a Windows service or passing a static value in from the service.
I've also tried using a formula but that only pulls back the sum of QtyPacked for that distinct order line and not all packed orders in the DB:
SUM('{tblPickingSlipLines.QtyPacked}', '{tblProducts.ProductId}')
Any help would be greatly appreciated.
try using the sub report for this purpose.
Write your second query in sub report and pass the tblProducts.ProductId to the record selection parameter of the sub report through sub report links now your query comes in sub report as:
SELECT ISNULL(SUM(QtyPacked), 0)
FROM tblPackingSlipLines
WHERE Status = 'Packed'
AND ProductId = {pm-product ID}

Crystal Report: Get Minimum Date

I have this concern using Crystal Report which I am not really familiar with. Here's my scenario:
I have an existing report to update, I need to add a column (ETA) which has a datetime value. It may return more than one rows per Item No, I need to get the minimum date only per Item No from the result rows.
I already tried some solution mentioned here http://scn.sap.com/thread/1952829 but found no luck.
I used a suppression formula for the Details section of the report, but haven't succeeded yet.
IF {TableName.DateField} = Minimum({TableName.DateField}) THEN FALSE ELSE TRUE
Any possible things you can suggest me to try? Thanks in advance for this :)
good to get this value from sqlserver side. you just create a function which return a single data (minimum date).
If you wish in crystal report side, it is something you make loop of hundred for a single row display. You can use running total field for this.
Select the field , select summary type and put into the detail section.
or you can create a formula with group name option like
Minimum({TableName.DateField})
http://scn.sap.com/thread/1952829
http://businessintelligence.ittoolbox.com/groups/technical-functional/businessobjects-crystal-l/unable-to-filter-based-on-the-first-date-in-list-of-dates-4912881
please check
Running total field gives options for Min, Max, etc. but not Sum
http://flylib.com/books/en/4.229.1.28/1/

Crystal Reports Record Selection and Summary Field conflict

I am really new to Crystal Reports and I am looking for any suggestions on how to approach the following issue:
I currently have a report that uses a record selection to limit the results by date. I would like to include in this same report a summary a total count of all the records (ignoring the record restriction). Unfortunately (although somewhat expected), the summary calculates the total after the record restriction is applied. Is there any way to get around this? In case my question is a bit unclear I've included a generic example below:
I have a report that pulls info from a database with a total of 10 records.
I select a specific date range, and it only returns 3 records
I would like to include in the report footer that 3/10 records are getting returned.
This is bit tricky to perform in crystal reports as record selection is compulsory applied. However you can overcome this by using sub report.
Calculate the report footer using report.
This will surely work