I have written a Web Data Connector that queries an API and gets data for a year that is passed in via the URL. All good and working
However, I want to extend the API to get more than one years worth of data but the way the API is structured, I would need to make multiple calls to this in the URL - one url string per year therefore one getJSON call per year.
I have tried wrapping the calls into a for loop and running the call for every year between a start and end range, building each url string fro the GetJSON based on the value in the variable in the for. This works fine in the simulator where - I believe - it is just responding to the AppendRows call. When I run this in Tableau Desktop, it only ever gets one year of data and then exits. As far as I understand, this is because the doneCallBack(); has to be ran after table.appendRows(); and I think it is showing the first getJSON call that has asynchronously called back to the script
If I move the doneCallBack() outside of the for loop, the WDC does not bring any data back.
It is especially annoying that I thought I had this working in the simulator but in desktop not - that made me sad
Looking forward to hearing if anyone has come across this and found a resolution.
I have raised this question with a few resources familiar with the WDC and hope to have a reply shortly to assist you.