DataSource not updating if API call returns empty set.

Stimulsoft Reports.JS discussion
Post Reply
basespetley
Posts: 4
Joined: Tue Apr 02, 2019 5:35 pm

DataSource not updating if API call returns empty set.

Post by basespetley »

I have a call I'm making to my API that returns a set of objects to map to the report.

Path to JSON data looks like this:

/api/report?company={Company}&end_date={end_date}

When I update the date, and there is data to be returned, everything is fine and the report updates.

If I pass a date that has no data in the database, I return an empty array to the JSON data source, however the report does not update, it will continue to show the old data from the last successful API call (one that returned data).

How can I ensure my report refreshes when receiving an empty set?

Cheers,

Stan
basespetley
Posts: 4
Joined: Tue Apr 02, 2019 5:35 pm

Re: DataSource not updating if API call returns empty set.

Post by basespetley »

For the record, my current hack for this is to return an empty data set WITH the keys.

i.e.

Instead of return []

I return [key1: null, key2: null...] etc.

This works but will be a PITA to do everywhere. Is there another way?
Lech Kulikowski
Posts: 7291
Joined: Tue Mar 20, 2018 5:34 am

Re: DataSource not updating if API call returns empty set.

Post by Lech Kulikowski »

Hello,

Please send us a sample report for analysis.

Thank you.
Post Reply