Inserting Missing Dates into Crystal Report - crystal-reports

I'm using Crystal Reports 10.
In my database I have production values for each Date. There's a date column and a qty column. When I run a report on this the dates on the report correspond to the dates in the database, but I'd like the report to display every date and if there is no value for it a 0. Is this possible to do right in the report?
The date is a group field with detail suppressed. The numeric values are a sum of the details placed in the group header, if that makes a difference.

You have 2 questions.
To display a 0 for null values, you can go into your options menu and "convert database NULL values to default"
Alternatively, you can use make a new formula with this code and use if isnull({Table1.Amount}) then 0 else {Table1.Amount}. I recommend this option since it won't affect other fields in the report.
To display every date, you should make a 'helper/index' table in your datasource and right-join your actual data to it. Crystal can't display data for, say, 01/07/2010 if there are no records for it.

Related

Converting a date time field in crystal report to date field

I am trying to link two different tables by date. table 1: Date is a date and time field table 2: Date is a date field
I am using Crystal report 11 and in the report options; converting to the date field is not an option
Can't do such a join in Crystal.
Consider creating a View in the DBMS to take care of converting the data type in one of these tables.
Other options:
No join but use a record selection condition. Performance would suffer but if number of records is not too large that should work.
Use a Command.
Use one table in the main report and link to the other via a subreport link.

SAP Crystal Reports multiple numeric range selection

I'm trying to create the report in SAP Crystal Reports (BusinessObject CR 2013 SP5) which display a number of the records from the database. My record selection is based on the item number which goes from 0 to 9999999. If I want to select specific numeric range (i.e. between 2500000 to 2600000) I used following record selection formula:
{v_R_rvc_menuitem_fam_grp.menuitem_number} in ToNumber({#Start_ItemRng1}) to ToNumber({#End_ItemRng1});
where the #Start_ItemRng1 is set to 2500000 and #End_ItemRng1 is 2600000.
My problem is that I need to add second numeric range into the formula (records btween 2700000 to 2800000). This way the report would returns records between 2500000-2600000 and 2700000 to 2800000. Unfortunately my all attempts returns with error code. Any suggestions how to correctly write the record selection formula?
Create two new parameters called #Start_ItemRng2 and #End_ItemRng2. Then update your record selection formula to this...
{v_R_rvc_menuitem_fam_grp.menuitem_number} in ToNumber({#Start_ItemRng1}) to ToNumber({#End_ItemRng1})
OR
{v_R_rvc_menuitem_fam_grp.menuitem_number} in ToNumber({#Start_ItemRng2}) to ToNumber({#End_ItemRng2})

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: Need to use a summary field as part of the Record Selection Formula

I have a fairly basic report that needs to show events with a total spend of >$200K OR event attendance >60ppl. The attendance portion is no problem, as it's a simple text field in the table. The expense spend is a field that has to be summed before it can be used, coming from a separate table with multiple entries per event. I have no problem doing this in a summary field dropped in the eventID header or even using a subreport and passing a shared variable to the main report. The problem I run into is that I cannot access this summary field in the report record selection to extract the either or records. Any idea how I can do this accurately?
Create a sql-expression field for total spending:
//{%total_spending}
(
SELECT sum(Amount)
FROM Meeting_Expenses
WHERE MeetingId=Meeting.Id
)
Use fields in record-selection formula:
{Meeting.actual_attendance}>60
AND {%total_spending}>200000

How do I do a CR-type formula in SQL Server Reporting services?

In Crystal Reports, I could define a formula that would evaluate for each detail line. For example, if I had a query that would return a PatientId, an ObsTerm name, and an ObsTerm value, I could define a formula called {#Hispanic} that had the value:
If {Command.OBSNAME} = "HISPANIC" Then
{Command.OBSVALUE}
Else
" "
Then, in the group footer, I could take Maximum({#Hispanic}, {Command.PATIENTID}) to see if I had gotten a value returned for the patient's ethnicity - either I'd get the value (assume only one, since that's how I built the query) or a blank.
I'm trying to convert a CR report over to SSRS 2008R2: how would I do the above? Thanks.
Add a calculated field to your data source (called 'Hispanic' or whatever) with a formula of:
=IIF(Fields!OBSNAME.Value="Hispanic",Fields!OBSVALUE.Value,"")
In your report, add a parent group to your detail row and type [Max(Hispanic)] into a field in the group row. You may then want to hide the detail row and show only the aggregate data. I think there's probably a much easier way to do what you want but it's not clear from your question.
I made the transition from Crystal to SSRS and it is a hard road. You need to unlearn all your Crystal (especially formatting).