Quintiq file version 2.0
#parent: #root
Method QueryDataFromServer (
  Number top,
  String timespanoption,
  DateTime dateTimeFrom,
  DateTime dateTimeTo
) as shadow[KpiSnapshotSetData] id:Method_Kpi_GlobalState_QueryDataFromServer
{
  #keys: '[146874.0.1589147424]'
  Body:
  [*
    // Queries the KpiTracker dataset for the last <top> snapshots.
    data           := null( NamedValueTree );
    if ( timespanoption = "all" )
    {
      data := KpiTracker.SnapshotRetrieval().GetLastSnapshotsNvt( top );
    }
    else
    {
      from := dateTimeFrom;
      to   := dateTimeTo;
      data := KpiTracker.SnapshotRetrieval().GetSnapshotsNvt( from, to,timespanoption, top );
    }
    
    return Kpi_GlobalState.ConvertNvtToShadowSnapshotSetData( data );
  *]
  ReturnsOwning: true
}
