question

Upvotes
Accepted
5 2 2 2

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 512.0 KiB each and 1.0 MiB total.

Upvotes
Accepted
79.2k 251 52 74

@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 512.0 KiB each and 1.0 MiB total.

Upvotes
5 2 2 2

Works perfectly, thank you !

icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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