Page 1 of 1

2 questions on columns and Time scale.

PostPosted: Thu Jun 30, 2011 9:40 am
by DrewF
First, I've read over the AddingColumns doc and I fear my answer here is no. But does the calendar have the capability (or does FM for that matter) to make the number of columns change dynamically? I would like to be able to set a value and have the columns change based upon that value.

Second, is it possible to code the time scale to automatically jump to the nearest hour based upon current time? i.e. it's 1pm and I open the calendar I don't want to see 8am appointments.

Thanks for all your help, Drew.

Re: 2 questions on columns and Time scale.

PostPosted: Fri Jul 01, 2011 8:23 am
by JasonYoung
Hi Drew,

You are correct about the columns, for better or worse, that's all done at the layout level =)

I like the idea of jumping based on the current time. The displayed start and end times are held in the global fields: CalendarInterface::TimeStartGlob and CalendarInterface::TimeEndGlob

So, you could write a script that goes a something like this:

Loop
IF [ Get ( CurrentTime ) > CalendarInterface::TimeEndGlob ]
*Time is greater than what is being displayed, scroll down
Perform Script [Time Later]
End If
Exit Loop if [ CalendarInterface::TimeEndGlob ≤ CalendarInterface::TimeEndGlob ]
ExitLoop

Let me know if that helps,
Jason

Re: 2 questions on columns and Time scale.

PostPosted: Tue Jul 05, 2011 10:50 am
by DrewF
Jason, thanks for the help. This is what I came up with.

If [ $$sc_Mode = "Day Sched" or $$sc_Mode = "Resource Sched Vert" or $$sc_Mode = "Week Sched" ]
If [ Get(CurrentTime) ≤ CalendarInterface::TimeStartGlob or Get(CurrentTime) ≥ CalendarInterface::TimeEndGlob ]
If [ Get ( CurrentTime ) > CalendarInterface::TimeEndGlob ]
Loop
Perform Script [ “Time Later” ]
Exit Loop If [ CalendarInterface::TimeEndGlob ≤ CalendarInterface::TimeEndGlob ]
End Loop
Else If [ Get ( CurrentTime ) < CalendarInterface::TimeStartGlob ]
Loop
Perform Script [ “Time Earlier” ]
Exit Loop If [ CalendarInterface::TimeStartGlob ≤ CalendarInterface::TimeStartGlob ]
End Loop
End If
End If
End If

I placed this script in the Refresh calendar script but that proved to be wrong. The script would work fine but when i would try and use the Time up and down arrows it would go forward(or back) and then refresh back to current time. So any ideas where I can place the script within your script procedures?

Re: 2 questions on columns and Time scale.

PostPosted: Tue Jul 05, 2011 11:19 am
by John Sindelar
How about something a little simpler: after your If test, instead of running a loop, set the field CalendarInterface::TimeStartGlob to the current time (or the hour of the current time) and then call the script "Round Time".

Or if you want this to happen automatically: just add the set field to the beginning of the script Load Calendar Layout. Here you'll want to set the hour of the current time, not the time itself, like Time ( Hour ( get ( CurrentTime ) ) ; 0 ; 0 )

Re: 2 questions on columns and Time scale.

PostPosted: Tue Jul 05, 2011 12:03 pm
by DrewF
John, thanks for the quick reply. Your solution as well as Jason's both work very well. However adding your set field to the beginning of Load calendar Layout script 'locks' the time display to that current hour and onward. it is a matter of jumping to the current time and then going back to 'normal' seedcode functionality.

I will work on it some more and see what I come up with. Thanks again for the help, Drew.