Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 5543 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I have a custom function calculating Elapsed Time from when an email comes in to the database. heres the function:

Let (

[

seconds = If( IsEmpty(tsEnd) ; "" ; tsEnd- tsStart) ;

minutes = seconds/60 ;

hours = minutes/60 ;

days = hours/24;

months = days/30;

years = months/12;

displaySeconds = Mod(seconds ; 60);

displayMinutes = Int(Mod(minutes; 60));

displayHours = Int(Mod(hours ; 24));

displayDays = Int(Mod(days; 30));

displayMonths = Int(Mod(months; 12));

displayYears = Int(Div(months; 12))

];

Case(

IsEmpty(tsEnd); "" ;

displayDays & "d " & displayHours & "h " & displayMinutes & "mins"

) // end Case

) // end Let

when an emails age is under an hour, is displays as follows:

"0d 0h 23mins"

I would like it to display as "23mins"

When an emails age is over an hour but under one day it displays:

"0d 4hr 32mins"

i would like it to be displayed as "4hrs 32mins"

The below Case statement controls the output:

Case(

IsEmpty(tsEnd); "" ;

displayDays & "d " & displayHours & "h " & displayMinutes & "mins"

) // end Case

i need to figure out the calculation or statement to enter here so that:

1. IF days = 0 then "(displayHours & "h " & displayMinutes & "mins")"

elapsedtime.zip

Posted

I attempted to download your file, and it failed to decompress.

Here is a Custom Function that might help you. Link, if not, look around Brian Dunning's site as there are others.

BTW, you don't reflect that you have the Developer or Advance Edition of FileMaker in your profile, If you are using one of these, you need to update your Profile.

Lee

Posted (edited)

SOrry, just updated my info as i see it can be useful. Here is another try at uploading my sample data, i got the custom function from that same website, the problem is the one you sent me does not tell me the number of minutes.

I dont know why my zip files are corrupt, but what below are two files, please download the larger of the two and rename the file from .zip to .fp7

its not compressed, i just changed the extension so that the server at fmforum allows me to upload it without becoming corrupt

elapsedtime.zip

elapsedtime.zip

Edited by Guest
Posted

its not compressed, i just changed the extension

Please don't do that.

As for your calculation, try:


Let ( [

e = tsEnd- tsStart ;

d = Div ( e ; 86400 ) ;

r = Mod ( e ; 86400 )

] ;

Case ( not IsEmpty ( tsEnd ) ; 

Case ( d ; d & "d " ) & Hour ( r ) & "h " & Minute ( r ) & "mins "

)

)

Posted (edited)

You should remove all of your attachments.

You have to actually Zip the files, or they do NOT come through so that we can open them.

These two files acted the same as your first file. i.e. they do not open. Zipping a file does not corrupt them it.

Lee

Edited by Guest
Posted

thanks, that is perfect. i was trying to understand the function but didnt quite get it. i was trying to figure out how i could get rid of the 0h so that anything under an hour only displays the mins. this is not important but would be nice to have

thanks in advanced,

Posted

Well, then:


Let ( [

e = tsEnd- tsStart ;

d = Div ( e ; 86400 ) ;

r = Mod ( e ; 86400 ) ;

h = Hour ( r ) ;

m = Minute ( r )

] ;

Case ( tsEnd ; 

Case ( d ; d & "d " ) & 

Case ( h ; h & "h " ) &

Case ( m ; m & "mins " )

)

)

This topic is 5543 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.