| Quintiq file version 2.0 | 
| #parent: #root | 
| Method ConvertShadowSnapshotSetDataToNvt ( | 
|   shadow[KpiSnapshotData] shadowSnapshot | 
| ) as NamedValueTree id:Method_GlobalStateKpiTracker_ConvertShadowSnapshotSetDataToNvt | 
| { | 
|   #keys: '[136398.1.783148843]' | 
|   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 | 
| } |