rayh34 Posted February 3, 2007 Posted February 3, 2007 I am trying to find the difference between the creation timestamp and the current timestamp, then if the difference is more then 20 days to set that record to inactive. Timediff :[color:blue]Calc, unstored = Let ([ time = Get ( CurrentTimeStamp ) - Timefirstshark ; days = Div ( time ; 24 * 60 * 60 ); time = Mod (time; 24 * 60 * 60 ) ]; days & ":" & Hour ( time ) & ":" & Minute ( time ) & ":" & Seconds ( time )) Active:[color:blue] Calc, unstored = Case (Timediff > "20:0:0:0" ; "No" ; "Yes" ) It seems to work at first, but then for some reason it thinks 10:0:0:0 is less then, but 4:0:0:0 is greater?
LaRetta Posted February 3, 2007 Posted February 3, 2007 There are many approaches. This produces a 0 if it has lapsed and a 1 if not. This is kinda cool (using boolean 1/0) because you can then format your layouts as number (boolean display of [color:green]Lapsed if FALSE 0 and [color:green]Active if TRUE 1). Let ( lapse = 86400 * 20 ; TimeFirstShark + lapse < Get ( CurrentTimeStamp ) ) The calculation must be Unstored in Storage Options. If you have your heart set on hard-coding in the field, then use Case() or If() like so: Let ( lapse = 86400 * 20 ; If ( TimeFirstShark + lapse < Get ( CurrentTimeStamp ); "Active" ; "Expired" ) ) I took liberties of wasting an evaluation for clarity because down the road you may wonder what 1,728,000 meant and this clearly indicates 20 exact days. Using 1/0 allows changing what you CALL the result simply by displaying it at the field level. You may want to call it Yes/No in one location, Active/Expired in another and even Current/Lapsed in another. It also easily allows filtering and control of display for portals. LaRetta
rayh34 Posted February 3, 2007 Author Posted February 3, 2007 Great LaRetta, Made one small mod: TimeFirstShark + lapse [color:red]> Get ( CurrentTimeStamp )
Recommended Posts
This topic is 6850 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 accountSign in
Already have an account? Sign in here.
Sign In Now