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 ?



Best Answer

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    Answer ✓

    @ammeggs

    It returns NA when using the following formula in Excel.

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


    image

    The equivalent C# code is:

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

Answers