Crystal reports 10 selection between time - crystal-reports

Being new to Crystal could someone point me in the correct direction.
I have a field, in an SQL view which is datetime.
I have converted this to time only using
time ({rep_Sterling_YEARLYSHEETCOUNT.StartDateAndTime})
I now want to use this in a further formula to determine if the operation occurred on the day or the night shift
if {#Time Convert} > #06:00:00# and {#Time Convert} < #18:00:00#
Then 'Days'
Else 'Nights'
However I am told 'A Date-time is required here.
What have I got wrong?

When you enclose in betweed # it will be treated as datetime and hence the error.
So change like this:
if {#Time Convert} > Ctime("06:00:00") and
{#Time Convert} < Ctime("18:00:00")
Then 'Days'
Else 'Nights'

Related

Getting the Age using Parameter Value and Current Date [CRYSTAL REPORT]

I'm trying to get the age of my user in crystal report using parameter and current date.
This is my formula for the crystal report.
INT ((CurrentDate - {?txtbdate}) / 365.25)
For example: the date in {?txtbdate} is 1996-07-29 and today
is 2018-10-25.
The age must be 22.
When I execute it, a popup message appear saying "A number is required here."
This is just a blind guest, but you must first convert the data before doing the math,
For ex. (INT (CurrentDate) - INT ({?txtbdate})) / 365.25
each value must be Identified as integer before subtracting
The Right way of doing it:
you can use the DateDiff function on the
ex. DateDiff("yyyy", CurrentDate, {?txtbdate})

Filtering exception report for past 24 hours

Currently working with Blue Prism and I want my exception report to only bring back exceptions from the last 24 hours.
I have tried using 'Today()' in the 'Report From Dt' and 'Report To Dt' which works fine however there is a chance my process will ru into the next day and thus makes this not viable.
Is there a calculation for the past 24 hours?
The action "Get Reports Data" from BO "Work Queues" requires an input in form of DateTime variable.
The Today() function outputs a variable of the type Date, which is then cast into the datetime variable. When BluePrism casts a date to datetime, then it sets a time to a midnight. The answer for your problem is that you need to supply the action "Get Reports Data" with the DateTime variable that will be a datetime of now - 24hours!
Example solution to that could be:
Now()-MakeTimeSpan(0, 24, 0, 0)

spss-modeler date difference getting negative results

First of all, I'm new to SPSS modeler, sorry if my question sound too obvious for experts, but what I'm trying is to calculate the date difference between two date values ( arrive_Date , Depart_Date ) in (Hours), I used this function time_hours_difference , this function works okay if the Arrive_Date and depart_date are the same day, but if the days are different, the date difference is in negative value, I searched and enabled this option: Rollover days/mins in stream properties, but the problem remains the same.
I hope you can help me with this beginner question.
Thanks
Hope its not too late. You are getting negative values because time_hours_difference extract only the time from the two specified timestamps and computes the difference out of it. It doesn't take the date values into account.
For example:
time_hours_difference('2012-08-02 14:10:50,2012-08-05 13:36:26)
Output:
-0.573
Remember, here time_in_hours('0130') under time format 'HHMM' evaluates to 1.5.
Here is my solution: in order to take days into account, first extract date_days_difference and multiply it with 24 to bring it in Hours and then sum it up with the time difference using time_hours_difference.
date_days_difference(arrive_Date,Depart_Date)*24 +
time_hours_difference(arrive_Date,(to_string(datetime_date(arrive_Date)) >< " 23:59:00")) +
time_hours_difference((to_string(datetime_date(Depart_Date)) >< " 00:00:00"),Depart_Date)

vb6 error 380 Datepicker, bust just in certain dates

Im having a problem with a datepicker on vb6, but this jus happen on certain dates, for example 31/01/2017, but with another dates it works fine.
I appreciate the help
This almost certainly has to do with how you are setting the date in the control.
For instance if the control's value is ANY month that does not have 31 days then you will get that error. Trying to set the control to 31/02/2017 would cause an error 380.
There are two approaches you can take to fix this.
Reverse the order you set the date components.
dtFecha.Year = Year(fcsAux.Fields("xf3ch4"))
dtFecha.Month = Month(fcsAux.Fields("xf3ch4"))
dtFecha.Day = Day(fcsAux.Fields("xf3ch4"))
Set the Value property instead of the date components. dtFecha.Value = "31/02/2017"
dtFecha.Value = rcsAux.Fields("xf3ch4").Value
The first approach ensures the month is always appropriate for the day. The second approach sets the entire value at one shot and should be a valid date.

Switching date format in Crystal Reports

I have been trying unsuccessfully to find a way to filter out records from a report.
I have a field titled time_period in a view that returns a date in the "MM/YYYY" format.
I have two parameters titled startMonth and endMonth which are in "MM/DD/YYYY".
Somehow I need to be able to make sure that the date_grouping field value is between the two parameters.
Here's what I have so far...
{location_total_kpi_view.time_period} >=
Date(Month({?startMonth}) + Year({?startMonth})) and
{location_total_kpi_view.time_period} <=
Date(Month({?endMonth}) + Year({?endMonth}))
It excludes all records. Any suggestions?
Try converting them both to yyyy/MM format and then into dates to make sure that the comparisons are equal, like this:
Date(ToText({location_total_kpi_view.time_period}, "yyyy/MM")) >=
Date(ToText({?startMonth}, "yyyy/MM")) and
Date(ToText({location_total_kpi_view.time_period}, "yyyy/MM")) <=
Date(ToText({?endMonth}, "yyyy/MM")) and