Bug Fixes in the Grid View's Day Scale

Support for our integrated Contact Manager, Calendar, and Project Tracker.
SeedCode Staff
SeedCode Staff
Posts: 2764
Joined: Thu Nov 20, 2003 11:01 am
PostPosted: Tue Mar 16, 2010 12:59 pm
Overview

Version 5.53 of the calendar makes a couple changes to how the day scale works. Here are instructions for making these changes in your copy of the file. If you'd rather get a fresh copy (to copy and paste scripts from) just email support at seedcode.com and as for a copy: please include your license number / order number (the thing that looks like SC3887612091) if you can.

The Fix...

Follow the instructions below to make these changes in your copy of the file...

Auto Enter Calcs. We changed the auto enter definitions of two calcs in the Calendar Rows table. Replace your auto enter definitions with these:

DateRangeStartAutoGlob:
Code: Select all
Case (

// --------------------  Grid  -------------------- 

PatternCount ( $$sc_Mode ; "Resource Sched Horiz" )  and CalendarInterface::TimeScaleGlob = "day" ;

Timestamp (
    DateFocusGlob
;
    0
)

;

// --------------------  Day  -------------------- 

PatternCount ( $$sc_Mode ; "Day" ) or PatternCount ( $$sc_Mode ; "Resource" ) or PatternCount ( $$sc_Mode ; "Year" )   ;

Timestamp (
    DateFocusGlob
;
    If ( PatternCount ( $$sc_Mode ; "Sched" ) ; CalendarInterface::TimeStartGlob ; 0 )
)

;

// --------------------  Week  -------------------- 

PatternCount ( $$sc_Mode ; "Week" ) ;

Timestamp (
    Let ( [
        d = CalendarRows::DateFocusGlob ;
        s = CalendarRows::DateStartWeekOnMondayGlob = "Yes"
    ] ;
        If ( DayOfWeek ( d ) = 1 and s = 1 ;
            d - 7 + 1 ;       
            d - DayOfWeek ( d ) + 1 + ( If ( s ; 1 ; 0 ) )
        )
    )
;
    If ( PatternCount ( $$sc_Mode ; "Sched" ) ; CalendarInterface::TimeStartGlob ; 0 )
)
 ;

// --------------------  Month  -------------------- 

PatternCount ( $$sc_Mode ; "Month" ) ;

Timestamp (
    Let ( [
        d = DateFocusGlob ;
        FirstDay = Date ( Month ( d ) ; 1 ; Year ( d ) ) ;
        FirstDayofCalendar = FirstDay - DayOfWeek ( FirstDay ) + 1 +

        (
        Case (
        DateStartWeekOnMondayGlob = "Yes" and DayOfWeek ( FirstDay ) = 1 ; -6 ;
        DateStartWeekOnMondayGlob = "Yes"
        )
        )

    ] ;
        FirstDayofCalendar
    )
;
    0
)
) // End Case


DateRangeEndAutoGlob:
Code: Select all
Let ( [

schedmode = PatternCount ( $$sc_Mode ; "Sched" )

] ;

Case (


// --------------------  Grid  -------------------- 

PatternCount ( $$sc_Mode ; "Resource Sched Horiz" )  and CalendarInterface::TimeScaleGlob = "day" ;

Timestamp (
     GetAsDate ( DateRangeStartAutoGlob ) + $$sc_NumberOfColumns
;
    Time ( 23 ; 59 ; 59 )
)

;

// --------------------  Day  -------------------- 

PatternCount ( $$sc_Mode ; "Day" ) or PatternCount ( $$sc_Mode ; "Resource" )  or PatternCount ( $$sc_Mode ; "Year" ) ;

Timestamp (
    GetAsDate ( DateRangeStartAutoGlob ) +
        If (
            schedmode and CalendarInterface::TimeEndGlob < CalendarInterface::TimeStartGlob ;
        1 )
;
    If (
        schedmode
    ;
        CalendarInterface::TimeEndGlob
    ;
        Time ( 23 ; 59 ; 59 )
    )       
)

;

// --------------------  Week  -------------------- 

PatternCount ( $$sc_Mode ; "Week" ) ;

Timestamp (
    GetAsDate ( DateRangeStartAutoGlob ) + 6
;
    If (
        schedmode
    ;
        CalendarInterface::TimeEndGlob
    ;
        Time ( 23 ; 59 ; 59 )
    )       
)

;

// --------------------  Month  -------------------- 

PatternCount ( $$sc_Mode ; "Month" ) ;

Timestamp (
    GetAsDate ( DateRangeStartAutoGlob ) + 41
;
    Time ( 23 ; 59 ; 59 )
)

) // End Case

) // End Let


Scripts 1. Edit the script "Insert into Calendar - Write Event { No Content }" right after the comment "---- The cell is NOT empty…" the next IF after that WAS...

$sc_LastRow

and now is…

$sc_LastRow and CalendarInterface::TimeScaleGlob ≠ "day"

Scripts 2. Edit the script "Date Specific ( Date )" and append the following to the end of the calc used in the first If() statement:
Code: Select all
and

CalendarInterface::TimeScaleGlob ≠ "day" // always refresh the day scale of the grid view



Scripts 3. Finally, we made three changes to the script "Click in / Drag Event".

Edit the Set Variable line directly below the first comment "Get the date". Change this calc to:
Code: Select all
( ( Ceiling ( $sc_Row  / $$sc_RowsPerDay )  -1 ) ) * 7 + GetAsDate ( Extend ( CalendarRows::DateRangeStartAutoGlob ) ) +

Case (
PatternCount ( $$sc_Mode ; "Day" ) = 0 and PatternCount ( $$sc_Mode ; "Resource" ) = 0 or CalendarInterface::TimeScaleGlob = "day"  ;

Get ( ActiveRepetitionNumber ) - 1 ;

0

) // End Case

+  If ( CalendarRows::TimeDisplayCalcs > Time ( 24 ; 0 ; 0 ) and PatternCount ( $$sc_Mode ; "Sched" ) ; 1 ) // add suport for clicking into after midnight in the morning of the next day.


Next, change the Set Variable line directly below the comment "What date or resource did we drag to?" to this:
Code: Select all
Case (

// -------- Grid Day Scale ---------

CalendarInterface::TimeScaleGlob = "day" ; GetAsDate ( CalendarRows::DateRangeStartAutoGlob ) + $$sc_DragTargetColumn - 1 ;

// -------- Resouce Scheduling ---------

PatternCount ( $$sc_Mode ; "Resource Sched" ) ; CalendarRows::DateRangeStartAutoGlob ;

// ------------ Others ----------------

( ( Ceiling ( $$sc_DragTargetRow  / $$sc_RowsPerDay )  -1 ) ) * 7 + GetAsDate ( Extend ( CalendarRows::DateRangeStartAutoGlob ) ) + $$sc_DragTargetColumn - 1

)

+  If (  $sc_Time > Time ( 24 ; 0 ; 0 ) and PatternCount ( $$sc_Mode ; "Sched" ) ; 1 ) // add suport for clicking into after midnight in the morning of the next day.


Lastly, change the script parameter in the first Perform Script step after the comment "Move the whole event to drag destination". Change that script parameter to:
Code: Select all
"DateStart = " & $sc_Date & " ; DateEnd = maintain ; TimeStart = "
&
If ( CalendarInterface::TimeScaleGlob = "day" ; GetField ( $$sc_FieldForTimeStart )  ; $sc_Time )

&
" ; TimeEnd = " & If ( not IsEmpty ( $sc_Time ) ;  "maintain" )
&
If ( PatternCount ( $$sc_Mode ; "Resource" ) ; " ; Resource = " & $sc_Resource )


That's it.
John Sindelar
SeedCode
Posts: 18
Joined: Sat Feb 21, 2009 3:30 pm
PostPosted: Mon Mar 07, 2011 11:25 am
John,

In your instructions for Scripts 1, you've got a few characters that didn't translate properly when viewed in a browser. Specifically:

"---- The cell is NOT empty…" the next IF after that WAS...

-- and --

$sc_LastRow and CalendarInterface::TimeScaleGlob ≠"day"

I figured out that "…" is an ellipsis, what is "â‰"?

The code snippet for Scripts 2 has a similar problem.

Thanks!
Posts: 18
Joined: Sat Feb 21, 2009 3:30 pm
PostPosted: Mon Mar 07, 2011 11:32 am
Found my own answer....

"â‰" is "≠" (not equal)

Return to SeedCode Calendar

Who is online

Users browsing this forum: No registered users and 3 guests

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