Grid filtering on calculated time field

OliverR

Member
Hi guys, I'm trying to create a simple timing app but am struggling with something. Basically there are 2 date/time fields that contain a start time and stop time, and then a calculated field that contains the duration (ie. stoptime minus starttime).

I want to have a grid that shows only those records that have a positive duration, but I can't get it to work. I've attached an export file of a simplified application to illustrate my problem. If you press the refresh button on the starttime field, you get a negative duration. If you press the refresh button on the stoptime field, you get a positive duration. Press the submit button to submit a record, and the records show up in the grid below.

I've set up a filterfield with a default value of 00:00:00:00; I want only records with a duration GREATER than that to show up in the grid. How would I go about this? I've tried various filter settings and different data types for the filter field, but nothing seems to get me the result I want.

Any help would be greatly appreciated because I've been struggling with this for hours now :)
 

Attachments

Howard Heckman III

Administrator
Staff member
Hi Oliver,

I have attached a project of what I got to work. I added a parse field to pull off the first character of the Duration result. This value will be either a '-' or a number. I then switched the filter field to have a default value of '-', and used this in the filter on the grid. The filter is setup as Parsed Field <> the Static '-' field.

Let us know if this helps.
 

Attachments

OliverR

Member
Hi Howie,

That seems to do the job, thanks a lot! I hadn't thought of doing it like that. So I guess it's not possible to work with the '<=>' operands for calculated time fields?
 

Howard Heckman III

Administrator
Staff member
I originally tried to get that to work, the problem seemed to be that the resulting field cannot be set to a Data Type of Number. If it is not a number those comparisons don't work properly since it is considered a string.
 
Top