Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method ConvertShadowSnapshotDataToNvt ( 
 | 
  shadow[KpiSnapshotData] shadowSnapshot 
 | 
) as NamedValueTree id:Method_Kpi_GlobalState_ConvertShadowSnapshotDataToNvt 
 | 
{ 
 | 
  #keys: '[136402.0.1319126404]' 
 | 
  Body: 
 | 
  [* 
 | 
    // Converts a shadow[SnapshotData] object to a NamedValueTree. 
 | 
     
 | 
    nvt := NamedValueTree::Create(); 
 | 
     
 | 
    snapshotHandle  := nvt.GetHandle( 'KpiSnapshotData' ); 
 | 
    serverDtHandle  := nvt.GetHandle( 'ServerDateTime' ); 
 | 
    planDtHandle    := nvt.GetHandle( 'PlanDateTime' ); 
 | 
    retentionHandle := nvt.GetHandle( 'RetentionPolicyIdentification' ); 
 | 
    kpiHandle       := nvt.GetHandle( 'KpiValueData' ); 
 | 
    labelHandle     := nvt.GetHandle( 'KpiLabelData' ); 
 | 
    nameHandle      := nvt.GetHandle( 'Name' ); 
 | 
    valueHandle     := nvt.GetHandle( 'Value' ); 
 | 
    sourceDatasetMDSIDHandle := nvt.GetHandle( 'SourceDatasetMDSID' ); 
 | 
     
 | 
    root := nvt.Root().AddChild( snapshotHandle ); 
 | 
    root.AddChild( serverDtHandle, shadowSnapshot.ServerDateTime() ); 
 | 
    root.AddChild( planDtHandle, shadowSnapshot.PlanDateTime() ); 
 | 
    root.AddChild( retentionHandle, shadowSnapshot.RetentionPolicyIdentification() ); 
 | 
    root.AddChild( sourceDatasetMDSIDHandle, shadowSnapshot.SourceDatasetMDSID() ); 
 | 
     
 | 
    // Kpis 
 | 
    traverse( shadowSnapshot, Value, val ) 
 | 
    { 
 | 
      kpiNode := root.AddChild( kpiHandle ); 
 | 
      kpiNode.AddChild( nameHandle, val.Name() ); 
 | 
      kpiNode.AddChild( valueHandle, val.Value() ); 
 | 
    } 
 | 
     
 | 
    // Labels 
 | 
    traverse( shadowSnapshot, Label, lab ) 
 | 
    { 
 | 
      labelNode := root.AddChild( labelHandle ); 
 | 
      labelNode.AddChild( nameHandle, lab.Name() ); 
 | 
      labelNode.AddChild( valueHandle, lab.Value() ); 
 | 
    } 
 | 
     
 | 
    return &nvt; 
 | 
  *] 
 | 
  ReturnsOwning: true 
 | 
} 
 |