Error while putting select expert condition - crystal-reports

NEED SOME HELP WITH CRYSTAL REPORT. I was able to use the formula in select exert in one of my reports but the same formula is not working in another report.
All the fields are available in the new report also but it gives me an error " The formula cannot be used because it must be evaluated later".
My goal is just to make sure that the input date range is not more than 32 days. If there is another way to achieve please guide me.
Can anyone please help me.
The formula is
{#date difference} <= 32 and
currentdate - {#Start Date} <=60 and
{Command.DATE_TRANSACTION} = {?Date}
More details :
#date is my parameter.
#start date is formula minimum(#dtransate)
#End date is formula maximum(#transdate)
#date difference is formula DateDiff("d",{#Start Date} , {#End Date})+1

Move the condition from Record Selection Formula to Group Selection Formula.
Totals are not available to Record Selection Formula because it evaluates before totals are evaluated.

It worked by making two parameters as start date & end date in the record selection formula:
{Command.DATE_TRANSACTION} >= {?Start_Date}
{Command.DATE_TRANSACTION} <= {?End_Date}

Related

Creating yearly comparison after summarizing datediff in Crystal Reports

I created a report that calculated how many days it took a person to complete a task (datediff) and then calculated the avg. number of days it took a group of people to complete the same task (by summing the datediff and then inserting an "avg." function). The time frame used was set by using a "Start date" and "End date" parameter field.
Now, the end user is asking, "how does that average compare to last year?"
I gave a quick answer by creating a Cross tab where I made the "Start date" 01/01/2018 and the end date 12/09/2019 and then grouped by Year in the columns. That is not an exact year-to-year comparison since this is all of 2018 compared to YTD 2019.
I know there is a better way to do this. Any help is appreciated!
Each task has a unique ID, a start date, and an end date
Try using a subreport that shows the same summary data as the primary report, but for a modified set of Start and End Dates. Link the subreport using both Start Date and End Date, but subtract one year from each value. This will allow your primary report to show data for 1-1-2019 through 12-09-2019 and the subreport will show 1-1-2018 through 12-09-2018.
Here is the formula to subtract 1 year from a date.
DateAdd("yyyy", -1, {#StartDate})
You can use this formula in your selection criteria for the subreport or you can create a formula field in the subreport as well, then use that formula field in the selection criteria.

Getting Start Date and End date of a Crystal Report

Good day guys,
I have several reports generated using Crystal report with a Date Range value and I need to get the formular for the Start date and End date of the report
Several reports has been generated using Crystal Report. I have used the Minimum() and maximum() formulars to get the Start date of the range and also the end date of it. But it is only picking the start date for the two reports.
minimum({Dttable.Order_date})
I expect the Output to be that if the date range selected is
01/07/2019-31/07/2019
Output should be start date 01/07/2019
end date 31/07/2019
I got a way Around.
I had to use it as formular and not under RunningTotal

Formula to derive 'fiscal year' in Crystal Reports

ZP_TEST is a parameter field and it contains value 201210 - 201309 (BEx query selection variable)
From the above value we wanted to derive the fiscal year as 2013. Below is the formula that we have used but giving error.
DateValue (Maximum ({?[ZP_TEST]}))
Please correct the above formula if you see any mistake in it.

Obtaining a number between current date and event date in Crystal Reports

I am currently developing a daily safety report. I would like to write a formula to count injury free days if a certain condition is met. If the value in the Injury type Field is "Lost Time Injury" it should take the date from the Date Field and count the difference between the current date and time as a number.
If Not(Isnull({table.injuryType})) And {table.injuryType}="Lost Time Injury" Then
CurrentDate - {table.dateField}
Add a group to your report, with the Month parameter of your report.
and write a formula like this and add it to your header
if(certain check about injuries != null) then
(
no injuries
)
else
(
injuries++;
)
injuries;
hope it helps

Crystal report find the last month end date

In Crystal report, I want to find the last month end date if I give any date
I searched and got this : Crystal Report Date formula to make it the end of the month but nothing more specific to my query
eg:
Suppose if I give date as : 21/06/2013
formula: formula{?date}
expected output : 31/05/2013
Create a formula and use the following code
CDATE(DATEADD("d", -1, DATE(YEAR({?Parameter}), MONTH({?Parameter}), 1)))
the parameter must be of date type.
Try the following formula:
DateAdd ("d", -DatePart ("d", {?Parameter}), {?Parameter})