Adding an iCal style time line to the schedule page

Support for our integrated Contact Manager, Calendar, and Project Tracker.
Posts: 135
Joined: Fri Sep 28, 2007 3:09 pm
Location: UK
PostPosted: Wed Feb 24, 2010 7:36 am
I recently decided to add an indicator showing the current time range on the schedule view, similar to that found in iCal

Anyway, I thought I would share it...

Add a text box to the top portal row with your desired height and set conditional formatting with the following calculation choosing to set a fill colour etc as desired



---------------------------
Let (

timescale =
Case ( not IsEmpty (GetAsNumber(CalendarInterface::TimeScaleGlob)) ; GetAsNumber(CalendarInterface::TimeScaleGlob) ;
CalendarInterface::TimeScaleGlob = "half hour" ; 30 ;
CalendarInterface::TimeScaleGlob = "hour" ; 60 ) ;


Get(CurrentTime) ≥ CalendarRows::TimeDisplayCalcs and
Get(CurrentTime) < CalendarRows::TimeDisplayCalcs + timescale * 60

)

---------------------------

The portal row should now have an indicator as to the current time....
Steve Wright
SWS Solutions
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Wed Feb 24, 2010 4:09 pm
Fantastc!

Here is what Steve is talking about (see the thing red line at 11am):

Image

Here is a larger version.

I just used a field instead of a text block because I can't seem to get text blocks down to 1px in height (I used CalendarBlankRepsGlob). And you'll have to put this on each calendar tab you wish to see it (It doesn't make sense on the simple view or the month view).

VERY nice Steve; thanks!

...want to do one for the grid view? ;-)
John Sindelar
SeedCode
Posts: 135
Joined: Fri Sep 28, 2007 3:09 pm
Location: UK
PostPosted: Fri Feb 26, 2010 8:37 am
I just decided to go the field route also after having trouble getting it small enough to look neat... It doesn't quite look right having it highlite a full row.

Great screenshot...
Steve Wright
SWS Solutions
Posts: 135
Joined: Fri Sep 28, 2007 3:09 pm
Location: UK
PostPosted: Sat Feb 27, 2010 5:07 pm
Just realised that this does not show after midnight, due to the times being 26:00 28:00 etc so heres what I have so far, which does show past midnight.

Code: Select all
/*
Outputs a boolean 1/0
Conditional formatting is then a simple if Value is not equal to 0 : apply fill colour
*/

Let ( [

currentTime = Get(CurrentTime) ;
rowTime = Extend(CalendarRows::TimeDisplayCalcs) ;
normTime = Case ( rowTime > 86400 ;  rowTime - 86400 ; rowTime ) ;
actualScale = Extend(CalendarInterface::TimeScaleGlob) ;

timescale =
Case (
not IsEmpty (GetAsNumber(actualScale)) ; GetAsNumber(actualScale) ;
actualScale= "half hour" ; 30 ;
actualScale = "hour" ; 60 )

] ;

currentTime ≥ normTime and currentTime < normTime + timescale * 60

)
Steve Wright
SWS Solutions
Posts: 11
Joined: Tue Mar 07, 2006 10:39 am
Location: Eugene, OR
PostPosted: Wed Mar 03, 2010 5:13 pm
Thanks for the great idea. I'm adapting this for Pro 4.2 and am not able to display the highlight at the "30" or "half hour", for some reason. Also, I'm not able to figure out how to make this work without refreshing the window at each 30 minute interval. I have the following code set for a conditional on a global text field I added to the Hours table [HourSchedulingTimeLineGlob]. Any help would be appreciated. I'm running FMS/P 10 on Mac 10.5.X

Code: Select all
/*
Outputs a boolean 1/0
Conditional formatting is then a simple if Value is not equal to 0 : apply fill colour */

Let ( [

currentTime = Get(CurrentTime) ;
rowTime = Extend(CalSchedHours::HourTimeDisplayCalc) ;
normTime = Case ( rowTime > 86400 ;  rowTime - 86400 ; rowTime ) ;
actualScale = Extend(CalendarScheduling::CalHourScaleGlob) ;

timescale =
Case (
not IsEmpty (GetAsNumber(actualScale)) ; GetAsNumber(actualScale) ;
actualScale= "half hour" ; 30 ;
actualScale = "hour" ; 60 )

] ;

currentTime ≥ normTime and currentTime < normTime + timescale * 60

)
--Paul
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Wed Mar 03, 2010 5:28 pm
Hey Paul: very cool.

Try using HourTime_k instead of HourTimeDisplayCalc. That should get you showing at other time increments.

I'm not sure what you mean about refreshing at every 30 min interval: send us some more details if the change above doesn't help.

John
John Sindelar
SeedCode
Posts: 11
Joined: Tue Mar 07, 2006 10:39 am
Location: Eugene, OR
PostPosted: Wed Mar 03, 2010 6:06 pm
Thanks John. Everything seems to be working with your change. The window refresh is no longer an issue. Thanks a lot! I've been twiddling with this for 2 days!! Haha! My staff really likes how easy it is to spot the current timeline for the appointments they have. There should be a tax on how much fun I (we) have with your code!
--Paul
Posts: 11
Joined: Tue Mar 07, 2006 10:39 am
Location: Eugene, OR
PostPosted: Thu Mar 04, 2010 2:52 pm
I do have an issue with the new timeline advancement, after all...

Using the calendar's "Schedule" layout, and the timeline is at the correct position, I do work in another database window and 3.5 hours later, I notice, on the calendar's window in the background, that timeline is still positioned at the old time, 3.5 hours ago. Even when I click on the calendar window, the highlight stays on the old time. Not until I change to another calendar layout and go back or click on the "Go to Today" button does the timeline advance correctly.

Is there a method I can use to have the timeline always get positioned, automatically?
--Paul
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Thu Mar 04, 2010 5:24 pm
the timeline relies on an unstored calc, so anything you do to refresh the window (change tabs, make events, edit records, etc) will cause the timeline to move. It won't move on its own, an unfortunately selecting the window isn't enough to cause it to refresh.

However, using FileMaker 10 you can install on OnTime script trigger that refreshes the window every x minutes.
John Sindelar
SeedCode
Posts: 135
Joined: Fri Sep 28, 2007 3:09 pm
Location: UK
PostPosted: Thu Mar 04, 2010 6:05 pm
Using the OnTimer trigger, you could set it to refresh based on the current calendar scale, so on a 15 min scale, refresh every 15 minutes..

since there is obviously no point refreshing (unless you want to) every 15 mins for a 1 hour timescale.

You would just need to re-instate the OnTimer trigger when / if you change the timescale.
Steve Wright
SWS Solutions
Posts: 11
Joined: Tue Mar 07, 2006 10:39 am
Location: Eugene, OR
PostPosted: Fri Mar 05, 2010 11:30 am
Thanks John & Steve. That did the trick. I was thinking about a trigger plug-in, but wanted to hear from the experts. Thanks again.
--Paul
Posts: 135
Joined: Fri Sep 28, 2007 3:09 pm
Location: UK
PostPosted: Thu Mar 18, 2010 4:03 pm
Just thought you may be interested to know, at midnight, the line will show across all rows in the 'all day' section, since it has only just come to my attention I have not looked into it yet...

P.S.. think I have a browser cache issue, every time I visited the forum recently it showed no new posts... but theres loads :-(
Steve Wright
SWS Solutions

Return to SeedCode Calendar

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron
(855) SEEDCODE
[email protected]
Follow us: