Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SetDefaultValue ( 
 | 
  LibCal_CalendarRegistry owner 
 | 
) id:Method_DialogCreateEditEventType_SetDefaultValue 
 | 
{ 
 | 
  #keys: '[415136.0.725511682]' 
 | 
  Body: 
 | 
  [* 
 | 
    // Set default + init dialog 
 | 
    dialogInstance := dhDialogData.Data().WrappedInstance(); 
 | 
    isNew := isnull( dialogInstance ); 
 | 
     
 | 
    // Extract the parent product by filtering out the descendents of the selected products in order to prevent circularity 
 | 
    eventtypes := construct( LibCal_EventTypes ); 
 | 
    if( isNew 
 | 
        or dialogInstance.IsLeaf() ) // Is leaf 
 | 
    { 
 | 
      eventtypes := selectset( owner, EventType, et, true ); 
 | 
      currentScope := dhDialogDatas.Data(); 
 | 
     
 | 
      eventtypes := eventtypes.Difference( currentScope ); 
 | 
    } 
 | 
    else if( not dialogInstance.HasParent() ) // Is root level 
 | 
    { 
 | 
      eventtypes := selectset( owner, RootEventType, et, et <> dialogInstance ); 
 | 
    } 
 | 
    else // Has Parent and Child 
 | 
    { 
 | 
      allEventTypes := selectset( owner, EventType, et, et <> dialogInstance ); 
 | 
      myChildren := selectset( dialogInstance, AllChildren.AsChildren, c, true ); 
 | 
     
 | 
      eventtypes := allEventTypes.Difference( myChildren ); 
 | 
    } 
 | 
     
 | 
    dhParentEventTypeSelection.Data( eventtypes.Copy() ); 
 | 
  *] 
 | 
} 
 |