| Quintiq file version 2.0 | 
| #parent: #root | 
| Method InitializeTable ( | 
|   LibCal_Calendars subscribers, | 
|   LibCal_EventCategory category | 
| ) | 
| { | 
|   TextBody: | 
|   [* | 
|     // 甄兰鸽 May-28-2024 (created) | 
|     rownr                 := this.LibCal_SubscriberEventRow( relsize ); | 
|     subscribercolumn      := selectobject( this, LibCal_SubscriberEventColumn, column, column.RowName() = 'Line' ); | 
|     if( isnull( subscribercolumn ) ){ | 
|       subscribercolumn := this.LibCal_SubscriberEventColumn( relnew, RowName := 'Line' ); | 
|     } | 
|     eventcolumn := selectobject( this, LibCal_SubscriberEventColumn, column, column.RowName() = 'Event' ); | 
|     if( isnull( eventcolumn ) ){ | 
|       eventcolumn := this.LibCal_SubscriberEventColumn( relnew, RowName := 'Event' ); | 
|     } | 
|     timezone := this.LibCal_Calendar().GetTimeZone(); | 
|      | 
|     traverse( subscribers, Elements, subscriber ){ | 
|     //  info( '------------------------', subscriber.CalendarID(), subscriber.CalendarType() ); | 
|     //  traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation ){ | 
|       traverse( subscriber,Participation.astype( LibCal_Subscription ).LeadingParticipation, participation, participation.Event().EventCategory() = category ){ | 
|     //    info( '------------------------', participation.Event().Subject(), '------', participation.Event().EventCategory().Name() ); | 
|         event := participation.Event(); | 
|         row := selectobject( this, LibCal_SubscriberEventRow, row, row.Subscriber() = subscriber.CalendarID() and row.Event() = event.Subject() and row.EventType() = event.EventType() ); | 
|         if( isnull( row ) ){ | 
|           row := this.LibCal_SubscriberEventRow( relnew, RowNr := rownr, Subscriber := subscriber.CalendarID(), Event := event.Subject(), EventType := event.EventType() ); | 
|            | 
|           if( counter( this, LibCal_SubscriberEventRow, linerow, linerow.Subscriber() = row.Subscriber() ) = 1 ){ | 
|             subscribercell := subscribercolumn.LibCal_SubscriberEventCell( relnew, Value := row.Subscriber() ); | 
|             row.LibCal_SubscriberEventCell( relinsert, subscribercell ); | 
|           } | 
|            | 
|           eventcell := eventcolumn.LibCal_SubscriberEventCell( relnew, Value := row.Event() ); | 
|           row.LibCal_SubscriberEventCell( relinsert, eventcell ); | 
|           rownr := rownr + 1; | 
|         } | 
|      | 
|         endTime     := participation.EndDate().DateTime( timezone ).AddAsPeriod( timezone, event.EndTimeOfDay() ); | 
|         startTime   := participation.StartDate().DateTime( timezone ).AddAsPeriod( timezone, event.StartTimeOfDay() ); | 
|     //    info( this.ID(), startTime, endTime ); | 
|         if( this.ID() = 'Day' ){ | 
|           this.InitializeDay( this, row, startTime, endTime ); | 
|         }else if( this.ID() = 'Week' ){ | 
|           this.InitializeWeek( this, row, startTime, endTime ); | 
|         }else{ | 
|           this.InitializeMonth( this, row, startTime, endTime ); | 
|         } | 
|      | 
|       } | 
|     } | 
|   *] | 
| } |