Suggestion T2073
Visible to All Users

Ajax code to retrieve data after a certain time?

created 6 years ago

Hi,

I am using the code below to retrieve the entire database.

JavaScript
var currentRes = function () { var tmp = null; $.ajax({ async: false, type: 'GET', url: 'https://dxsurvey.com/api/MySurveys/getSurveyResults/xxxxx?accessKey=1234', dataType: 'json', success: function (data) { console.log(data); tmp = data; } }); return tmp; }();

How, if it is possible, can I modify it so that I only retrieve results after a certain date and time, so that I get only recent data?

Thanks!

Answers approved by surveyjs Support

created 6 years ago

Hello,

I've implemented the [from:till] selection API for getSurveyResults method. Here are the sample requests:

Code
https://surveyjs.io/api/MySurveys/getSurveyResults/537472e5-2db3-4a77-ae24-182498246882?from=2019-05-30T07:19:50 https://surveyjs.io/api/MySurveys/getSurveyResults/537472e5-2db3-4a77-ae24-182498246882?till=2019-05-30T07:19:50 https://surveyjs.io/api/MySurveys/getSurveyResults/537472e5-2db3-4a77-ae24-182498246882?from=2019-05-30T07:00:00&till=2019-05-30T07:19:05

Thanks, Serge
SurveyJS Team

    created 6 years ago

    Hello,
    We do not have this functionality yet. However, I believe we may add the needed parameters.
    What do you think we should add as parameters: since date x, last x records, last x days, last x hours?

    Thank you,
    Andrew
    SurveyJS Team

      Comments (2)

        Thanks Andrew,

        It would be great if the team can implement this.

        If I may add, the since date x could be extended to be

        since datetime x.

        This is because the inbuilt timestamp of the data in surveyJS looks like this:
        5/22/2019 12:52:02 AM +00:00

        It would be cool if the x in "since datetime x" could just be the timestamp of the last data saved without the need to do additional parsing of the timestamp.

        Hope to see this feature introduced soon! May I know how one can get an update of such new features?

          We will discuss this functionality on Tuesday-Wednesday, when we will talk about our tasks on next week. I believe it should be easy enough to implement. If it is not the case and it would require some efforts then we may delay it.
          We will be back to you in couple days anyway.

          Thank you,
          Andrew
          SurveyJS Team