Hi David,
For functions that are called from a worksheet, the Excel calculation engine is invoking the function, and it know what formula and cell that call is made from.
For the RTD feature, Excel also keeps track of the cell(s) that called a particular RTD topic. So when the RTD server tells Excel that the topic has a new value, it is Excel itself which then decides which cells to recalculate.
So the Timer code does not ‘know’ where to return the value to, it is Excel itself that knows what cells called the timer code.
-Govert
--
You received this message because you are subscribed to the Google Groups "Excel-DNA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to exceldna+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/566b09a6-dc72-4d8c-8a03-eaf9591ebf86n%40googlegroups.com.
Hi Hagai,
For RTD topics you don’t need to keep track of the caller to clean up.
There will be an RTD DisconnectTopic call to tell you when the RTD topic is no longer used, and that is the place to do the clean-up.
If you have an IObservable stream, the IDisposable.Dispose of the object you return from the Subscribe call will allow you to clean up.
Tracking the calling cells for RTD can be a problem if you want to do this kind of clean up, since an RTD topic can be linked from more than one cell, and after a formula is deleted the function does not get called again.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/1d007b22-a91c-4268-a237-ccf7b6e137a1n%40googlegroups.com.
Hi Hagai,
It’s hard to answer your questions without more context about the code you are writing.
We’ve discussed various ways of implementing RTD servers, and you might have to show exactly what you’ve done.
I’m answering here under the assumption that you have implemented your own RTD server, hence implemented the IRtdServer interface on some class.
DisconnectTopic Function you'v mentioned will automatically track after the all Topics which had been called?
I’m sorry, the correct name for the function is “DisconnectData”. See IRtdServer.DisconnectData method (Excel) | Microsoft Docs and various links for RTD information from our previous discussions.
I assume I should define some stuff but how do I do it ?
As you see, it gets called for a specific topic, when there are no more cells with RTD calls with the topic strings that defined the particular topic (as passed to the ConnectData function IRtdServer.ConnectData method (Excel) | Microsoft Docs
Your RTD server must already implement DisconnectData (it’s part of the IRtdServer interface). You can look at the examples I’ve previously linked to for details.
and what if I got multiples Topics how do I do it?
Every topic is given a TopicId by Excel, which is passed to your server in the ConnectData call. This same TopicID is passed to the DisconnectData call, allowing you to track the topic lifetime.
How does it know it shouldn't delete the cache yet because one or more of this topic is still on ?
Excel internally keeps track of whether there are still cells with RTD calls to a particular topic.
To view this discussion on the web visit https://groups.google.com/d/msgid/exceldna/44e06040-ada8-4003-93a9-f35222c6c80dn%40googlegroups.com.