question

Upvotes
Accepted
68 3 4 8

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.

tick-history-rest-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
Accepted
38.1k 71 35 53

@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.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
68 3 4 8

Hello,

Oh, I ignored that.

Thank you very much for your answer.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea