How do I apply a date range filter to a REST model?

wunwun
edited February 2018 in Questions
I have a REST model and it is pulling back data correctly. One of the fields is a Datetime and when I try to create a Date Range filter, nothing gets rendered. Am I setting it up wrong or is it just not possible to do? Any suggestions on how I can get a Date Range filter to work?

Thanks

Comments

  • edited February 2018
    wun,

    Check the documentation for your REST API.  If you can filter by date, it will be some kind of parameter or even a different end point that you need to use.  Then add a parameter with merge syntax to your Data Source URL that you can then use for your filter.

    Thanks,

    Bill
  • wunwun
    edited February 2018
    Thanks for the response Bill. Can you clarify what you mean by "can filter by date"? To give you some more context, the REST api I'm connecting to has query string values for start date and end date. I've created URL merge conditions for both these values. When I add the filter, I set the condition source to specify existing conditions and set the begin and end model conditions to the URL merge conditions accordingly. However, when I go to preview the page, nothing gets rendered. If it helps, here is what the query string on my endpoint looks like:

    ?MinCreatedDate={{MinCreatedDate}}&MaxCreatedDate={{MaxCreatedDate}}
  • edited February 2018
    wun,

    You answered my question about whether the end point supports filtering by date.

    I would look at the format of the date condition being set in your URL string.  I'd guess that the format you get from Salesforce doesn't match what your end point is looking for.

    Thanks,

    Bill
  • wunwun
    edited February 2018
    The date on the json comes over as:

    "CreatedDate": "2018-01-31T19:14:14.000Z"

    This field renders correctly on the ui and on the model also identifies it as a Datetime. As far as I can tell, everything looks fine, other than the date range filter not rendering.
  • edited February 2018
    wun,

    I recommend that you verify that the query by date range works using Postman or a browser.  Use this step to validate what format the API end point is expecting the date field to be in and compare this to what Skuid is sending.

    Thanks,

    Bill
  • Rob HatchRob Hatch 🛠️ 
    edited February 2018
    Unfortunately - I do not think you will be able to add a date range filter to a REST model.  The URL Merge conditions are not detected when you try to set up the range filter with manual conditions. 

    A work around would be to create UI only fields for "start date" and "end date" and pass these fields values into the URL merge condition you have created.  This will give you much tighter control over the values you pass into your REST API. 
Sign In or Register to comment.