question

Upvotes
Accepted
5 0 1 2

How to specify an absolute date in Datasteam Web Service (DSWS)

I got below code snippet from Quick start sample code:

Date = new DSDate()

{

Kind = DSDateKind.TimeSeries,

Start = "-30D",

End = "-10D",

Frequency = DSDateFrequencyNames.D.ToString()

}

But I want to make a request for a single date.

I found below examples from the link http://product.datastream.com/dswsclient/Docs/AboutNetApi.aspx

// Date (Snapshot) 
// An absolute date 
var date1 = new DSSnapshotDate(DSDateType.Absolute(DateTime.Now));

But I dont have DSSnapshotDate class in my datastream service reference.

Is there any other way by which I can make a single request for (Today-1) date using the 1st example that was mentioned in Quick start sample code ?


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

@prashant.busa

The examples from this link require the DSWS .NET API library.

However, the below code uses the DSWS SOAP Web Services.

Date = new DSDate()
{
Kind = DSDateKind.TimeSeries,
Start = "-30D",
End = "-10D",
Frequency = DSDateFrequencyNames.D.ToString()
}

Refer to this page, the dates can be relative dates or absolute dates or string literals, such as -30D (or) 2011-12-31 (or) BDATE.

You can use absolute dates with the following code.

Date = new DSDate()
{
    Kind = DSDateKind.TimeSeries,                     
    Start = "2019-11-15",
    End = "2019-11-28",
    Frequency = DSDateFrequencyNames.D.ToString()
}

Otherwise, you can use a relative date, such as "0D", or "-1D" for the last day.

 Date = new DSDate()
 {
     Kind = DSDateKind.TimeSeries,                     
     Start = "0D",   
     Frequency = DSDateFrequencyNames.D.ToString()
 }




1574914760534.png (38.8 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 2

Thank you jirapongse

I modified your solution a bit and got it working for me

Date = new DSDate()

{

Kind = DSDateKind.Snapshot,

Start = "2019-11-28",

End = "2019-11-28",

Frequency = DSDateFrequencyNames.D.ToString()

}


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