question

Upvotes
Accepted
5 0 1 1

C# API equivalent of DSGRID "Latest Value" function

Hello,

I'm using the following DSGRID function in Excel :

=Thomson.Reuters.AFOSpreadsheetFormulas.DSGRID('DE0005545503';'SOTDDP018';"Latest Value";"";"";"RowHeader=false;ColHeader=false;DispSeriesDescription=false;DispDatatypeDescription=true";"") 

Note that DE0005545503 is just an example

I tried to do the same using the C# API but I don't get the same coverage :


var dataStreamFunctions = new Dictionary<string, string>()
                {
                    { "SOTDDP018", "nombre d'heures moyen de formation par salarié" },
                };

var dataTypes = dataStreamFunctions.Keys.ToArray();

var request = new DSDataRequest()
                        {
                            Instrument = new DSInstrument("DE0005545503"),
                            DataTypes = new DSDataTypes(dataTypes),
                            Date = new DSTimeSeriesDate(dsDate, DSDateType.Literal(DSDateLiterals.LatestDate), DSDateFrequency.Daily)
                        }; 


var response = DSClient.DataService.GetData(request);

What C# function should I use in order to get the same coverage as the Excel DSGRID function ?



datastream-apidsws-apic#
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

@ammeggs

It returns NA when using the following formula in Excel.

=@DSGRID("DE0005545503","SOTDDP018","LATEST VALUE","","","RowHeader=true;ColHeader=true;DispSeriesDescription=false;DispDatatypeDescription=true","")


The equivalent C# code is:

var request = new DSDataRequest()
            {
                Instrument = new DSInstrument("DE0005545503"),
                DataTypes = new DSDataTypes("SOTDDP018"),
                Date = new DSSnapshotDate(DSDateType.Literal(DSDateLiterals.LatestDate))              
            };

1608777228164.png (14.3 KiB)
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
5 0 1 1

Works perfectly, thank you !

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