Crystal reports: using summary field in formula / summing time field in formula - crystal-reports

In crystal reports I want to show the sum value of time objects, i.e. An employee worked in one month three days and on each day a variable amount of hours.
Is there anyway to sum a time field?
Or as a workaround I could use the time field as an integer, sum this and display. But then I would like to change the display format by using a formula. I cant find a way to include summary fields in a formula...
Thanks in advance
PS I am using CR 2011 (just the program not through VB or anything).

You cannot sum a date/time field. You will have to use datediff("n",{datetime1},{datetime2}) to get a time interval between two date/time fields in minutes.
To use a summary function in a formula, you can use this sum({#YourMinutesFormula},{FieldYouAreGroupingOn})
You may omit the second parameter if you want the summation over the entire report instead of a grouping level. Check the Crystal Reports help file for more details on Sum().

Related

How can I use DateDiff in a seperate Crystal Reports formula?

I have a formula which uses DateDiff to find out the difference between two dates and excludes the weekends.
I'd like to then use that DateDiff in another formula to calculate averages based on and if/then criteria.
When I put average({date diff formula}) I receive an error of "Invalid Argument was encountered"
I can't use the date diff formula in any formula I try to use it in, is there a reason for this?
Example DateDiff formula:
DateDiff('d',*datecolumn*,today)
Then pass that thru into your running total, eg:
Make a grouping in your group expert for the set you wish to summarize with an average, select that group in the Evaluate section and, if desired, in the Reset as well.
Let me know if this isn't quite it for you, good luck!

Adding a / between numbers in crystal reports

I have a date field that shows as CYYMMDD. To get rid of the century I have just subtracted 1000000 to show the date as YYMMDD ex. 150814.
Now I want to add / between the numbers to show as 15/08/14.
How do I do this in the formula?
Thanks in advance!
There are few things to be considered here.
Simply right click on the date field once you place the same in crystal report, you will get options to format data. You can choose whatsoever suits you.
In case you go by your approach for substracting the number..., you can convert the number into strong and then can play with it.
Posting the links for the second point help.Split the number and modify in Crystal

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/

Using LIKE in Multi-Value Parameter in Crystal Reports 2011

I am developing a report in Crystal Reports 2011 that has 3 sub-reports pulling data from 3 different databases. I have a Multi-Value Parameter (String) in the main report that passes the input values to the 3 sub-reports which have the same Multi-Value String Parameter.
Sample Input Values are:
P000000030,
P000000930,
P000001730
The user does not want to input the leading alpha character and preceeding zeroes. They want to input the following:
30,
930,
1730
The sub-report pulls all of the records successfully if the user puts the entire string value in with the following Record Selection Criteria, but it does not work with the partial strings input:
{Command.Puchase Order} in {?Pm-?Reference}
Can anyone advise the syntax needed to pull the data in the subreport with the substrings as inputs?
Thanks in advance!
Thank you for your input guys!! I took a bit from everyone and came up with the following solution:
Create a column in the datasource that trimmed out the desired value --> ltrim(regexp_replace(a."po_num",'P',''),'0') as "Puchase Order2"
Modified my Record Selection Criteria to select for either column --> {Command.Puchase Order} in {?Pm-?Reference} or {Command.Puchase Order2} in {?Pm-?Reference}
I really appreciate your input! I am able to deliver the desired solution with your aid.
go ahead and create a formula that calculate the length of your parameter(len({?Pm-?Reference})) and place it suppressed on your report header. Then put below in your record selection formula
right({Command.Puchase Order},{your length formula}) in [{?Pm-?Reference}]
You could add the "number only" version of [Puchase Order] to your datasource...
cast(cast(right([Puchase Order], len([Puchase Order]) - 1) as int) as varchar(9))
as [Puchase Order Number]
...then use that in the select expert. I'm getting the number without the leading P, casting to int to remove the leading zeros, and then back to a varchar for the string comparison in Crystal.
You could do the same with a formula in Crystal reports. Then reference that formula in the select expert. Downside is having to repeat that in all 3 sub reports.

Inserting Missing Dates into Crystal Report

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.