Hi Dojo,
I'm working on an ad hoc data source that enables real-time updates. Everything functions well, but we encountered an issue where subscriptions are not removed. This occurs because, in the OnStopUpdates() method, we perform a .Reset, which creates a new connection. We need this since, from the LCA, we can select different elements, each displaying its own data to support real-time updates.
Is there a proper way to reset subscriptions so that, when the user selects a different element, these subscriptions reinitialize and point to the new elements? Alternatively, is there a way to dispose of the subscriptions? Here is a screenshot of the flow we attempted to follow using the OnStartUpdates, OnStopUpdates, and OnDestroy methods.
Thank you!
Hi Carlos,
It seems there may be some misunderstanding about the lifecycle of an ad hoc data source. Each time a user runs a query that uses this data source, a new instance is created specifically for that user and query.
I assume your setup passes the selected element to the data source. As a result, when the selected element changes, a new query is executed, effectively starting from a clean state.
In your example, it looks like you're using static classes that persist beyond the ad hoc data source's lifecycle, assigning them to a local variable. This structure seems unusual, so I’d recommend replacing these static classes with regular instances to ensure better alignment with the intended lifecycle.
Hi Sebastiaan! I'll give it a shot. Thank you!
Hi Carlos,
I’m not really following why the Reset creates a new connection, could you elaborate? Are there other options to Reset the data provider without creating a new connection?
Does the GQI query gets executed when the user selects a different element?
Best regards, Ward