Check variable of Time within a timeframe - crystal-reports-xi

Is there a way to check and see if a time is between a time duration in Crystal Report? Our application has a field, let’s say, called StopTime but stored in integer format. It has the value of 0 at midnight, 60 at 1 am, … , 12x60= 720 at noon.
There is a need for me to create an input parameter with type Time which allows a range value so that user could select to view records within a certain time in the day.
My question is how do I check the value of the field again the input parameter in the record selection formula? I have tried
cast({StopTime}/60 as time) in {?TimeDuration}
but I got the error “There is an error in the formula. Do you want to save it anyway?”
I have also tried
{StopTime}/60 in {?TimeDuration}
and still got the error.
The only way to get around this error is declaring the parameter TimeDuration as Number that accepts a range. However, if possible, it is better to use the type of Time as I can foresee user issues with Number range when a time range is actually needed.

Your field {StopTime} is a number representing a number of minutes, and so must be cast to a time. In Crystal Syntax this is achieved using the CTime function which takes a parameter of a number in days. Therefore you must divide the number of minutes by 1440 to get it in to days. The following will do what you need.
ctime({StopTime}/1440) in {?TimeDuration}

Related

Tableau: how to create calculated field for previous day value

I have created a monthly calendar in tableau that tracks enrollment sign ups for a business's rewards program. What I am trying to do is show the day over day % change between enrollment values. In this specific scenario, I am trying to find the % change between 371 to 499. However, to do this, I believe I first need to create a calculated field for the prior days value, so that I can then use the day over day % formula for all other values. Does anyone have any advice for this particular scenario?
I have tried using the datediff function, amongst other calculated fields, with no luck so far. I want to created a calculated field that will retrieve all "enrollment" values but only for the previous day, so that I can then use the "100*((final-initial)/initial) calculation to calculate the day to day % difference.
You can try this function. I think this might be the calc you need.
(ZN(SUM([Distance])) - LOOKUP(ZN(SUM([Distance])), -1)) /
ABS(LOOKUP(ZN(SUM([Distance])), -1))
You might have to play with the sign to get the result you want. Let me know if that doesn't work.

Query on Influxdb only returns data up to the current timestamp

I want to determine the maximum value per day including past and future. The data are forecast values. They also include the entire current day and the following day. But a query without a WHERE clause only returns results up to the current time.
This is the query so far:
SELECT max("Prognose_Wh") FROM "Wetterprognose" group by time(1d)
The result provides the maximum values per day in the past, including the maximum value of the current day, but only up to now(). Today's maximum value is incorrect because a higher value is reached later this day. The following day, which is also contained in the requested data, is missing in the result.
How can I create a query in influxql that returns results from the past as well as data from the future?

Getting Average m:s:ms time in Google Sheets

I am working on a Google Sheets file in order to get Track and Field Data.
The times run by the athletes are:
1:58.66
2:00.03
2:00.31
2:01.85
2:03.07
2:03.18
2:03.57
... etc.
In total I have 141 values. I have tried looking for functions to help me with this, but it seems as though these values are not accepted as numbers.
I need the average of all 141 times.
There is no direct way to get this done in excel, but you can achieve it using the following function (assuming your data is stored in column A)
=ARRAYFORMULA(sum(60*left(A1:A)+right(A1:A,5)))/COUNTA(A:A)
So, I used arrayfunction to go through the whole list at column A and converted it into seconds, then divided it by its count (using COUNTA for non-numeric values) to get the average seconds for all athletes.
You can export date in mm:ss.00 format again using this function,
=TEXT(B1/(24*60*60),"mm:ss.00")
Please note that TEXT function receives value (in days), hence you will have to divide the first function result (assumed it is at B1) by 24*60*60.
enjoy...

set grafana/influxdb time range based on max and min time of query

I have a series of events ranging from 1 to 8 hours that are tagged with a name over the last 2 years. Using the templating function I can move display the different events. My problem is that the time range doesn't rescale when i want to display an event that is outside the currently displayed time range. Ideally I would like to dynamically set the URL with the timestamp encoded from the max and min time of the database (influxdb) query. Any ideas on what I can do?
Here is a screenshot of my problem

Comparing Time Values

I want a method which compares the times, eg if Atime occurs earlier than Btime do something, I would use a CompareTime Function but my problem with this function is what is said in "Bold Brackets" (see below)
Call CompareTime to compare the two TDateTime values specified by A and B. CompareTime returns:
LessThanValue if A occurs earlier in the day than B (even if A occurs on a later day than B).
GreaterThanValue if A occurs later in the day than B (even if A occurs on an earlier day than B).
A TDateTime values can be thought of as containing two distinct parts: the date part and the time part. The CompareTime function only compares the time part and ignores the date part. The documentation says:
Indicates the relationship between the time portions of two TDateTime
values.
Call CompareTime to compare the two TDateTime values specified by A
and B. CompareTime returns:
LessThanValue if A occurs earlier in the day than B (even if A occurs on a later day than B).
EqualsValue if A occurs at the same time of day as B, ignoring the date portion of the two values.
GreaterThanValue if A occurs later in the day than B (even if A occurs on an earlier day than B).
You want to compare the entire date time value. To do that you should use CompareDateTime. One important note in the documentation for the function states:
Note: CompareDateTime differs from a direct comparison of the corresponding double precision values in that two TDateTime values are
considered the same if they have the same value down to the
millisecond. It is possible to create two TDateTime values that differ
numerically when viewed as doubles, but which represent the same year,
month, day, hour, minute, second, and millisecond.

Resources