Getting an extraction back

Hello everybody,

I launched asynchronous TickHistoryIntradaySummaries requests, with a schedule named

IntraDaySummariesSchedule.

On hosted datascope, the schedule shows a line of the type "

9011311.TH_IntradaySummaries_Schedule.20170720.170535.2000000001279640.tm03n01.csv.gz"

with a drop-down list, that provides to View / Download / Notes.

So, when I launch this

string strScheduleName = "TH IntradaySummaries Schedule";
Schedule schedule = this.FindScheduleByName(extractionsContext, strScheduleName);
if (schedule != null)
{
Console.WriteLine("Number of completed extractions : {0}", schedule.CompletedExtractions.Count);
}
else
{
Console.WriteLine("No schedule received.");
}

I should wait for at least 1, no ?

I am answered 0, as the number of completed extractions.

Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @Hubert CANEVET

    You need to call ExtractionContext::LoadProperty before accessing CompletedExtractions.

    extractionsContext.LoadProperty(schedule, "CompletedExtractions");

    The full code is:

    ExtractionsContext extractionsContext = dssClient.extractionsContext;

    var schedule = extractionsContext.ScheduleOperations.GetByName("TH IntradaySummaries Schedule");

    if (schedule != null)
    {
    extractionsContext.LoadProperty(schedule, "CompletedExtractions");
    Console.WriteLine("Number of completed extractions : {0}", schedule.CompletedExtractions.Count);
    foreach (var extraction in schedule.CompletedExtractions)
    {
    Console.WriteLine("Extraction {0} status = {1}", extraction.ReportExtractionId, extraction.Status);
    var reportExtraction = extractionsContext.ReportExtractionOperations.Get(extraction.ReportExtractionId);
    extractionsContext.LoadProperty(reportExtraction, "Files");
    Console.WriteLine("File Count {0}", reportExtraction.Files.Count);
    foreach (var file in reportExtraction.Files)
    {
    Console.WriteLine("File Name: {0}", file.ExtractedFileName);
    }
    }
    }
    else
    {
    Console.WriteLine("No schedule received.");
    }

    You can refer to REST API Reference Tree for C# snippet code.

Answers