Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method GetSetOfInterest (LibDMF_SystemOnChannel soc_i, String hierarchyName_i, output String feedback_o) as LibDMF_Set 
 | 
{ 
 | 
  Description: 'Retrieve the Set in the DataManager which the SOC is interested in, returns null if not used in DataManager.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Retrieve IntegrationEvent 
 | 
    root  := this.CommunicationChannelRoot(); 
 | 
    event := root.EventGetLast( soc_i.DatasetKind(), soc_i.DatasetName() ); 
 | 
     
 | 
    set := null( LibDMF_Set ); 
 | 
     
 | 
    if( this.CommunicationChannelRoot().IsDataManager() ) 
 | 
    { 
 | 
      hierarchy := select( this, Hierarchy, hier, hier.Name() = hierarchyName_i ); 
 | 
     
 | 
      if( not isnull( hierarchy ) ) 
 | 
      { 
 | 
        if( counter( hierarchy, SetType.Set, s, true ) = 0 ) 
 | 
        { 
 | 
          feedback_o := "No Sets found for Hierarchy " + hierarchyName_i + "; Channel = " + this.Name(); 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
          // Just take one of the Sets in which the System is interested. 
 | 
          set := select( hierarchy, SetType.Set, s, 
 | 
                         exists( s, Interest, interest, 
 | 
                                 interest.SystemOnChannel() = soc_i ) ); 
 | 
     
 | 
          if( isnull( set ) ) 
 | 
          { 
 | 
            feedback_o := "No interest specified in any of the Sets of Hierarchy " + hierarchyName_i + "; Channel = " + this.Name(); 
 | 
          } 
 | 
        } 
 | 
      } 
 | 
      else 
 | 
      { 
 | 
        feedback_o := "Hierarchy '" + hierarchyName_i + "' not found; Channel = " + this.Name(); 
 | 
      } 
 | 
    } 
 | 
     
 | 
    if( feedback_o.Length() > 0 ) 
 | 
    { 
 | 
      root.EventLogActivityWarning( event, 
 | 
                                    feedback_o ); 
 | 
    } 
 | 
     
 | 
    return set; 
 | 
  *] 
 | 
} 
 |