If you have a wrapper function for the RTD, the wrapper can return an array which you use in an array formula.
In particular the IExcelObservable mechanism should work fine for array formulas.
Another pattern is to have one cell return a ‘handle’ of some sort which you update with the RTD. Then have another function that just takes the handle and a property string, then looks up the array or object behind the handle internally, and returns the respective property. The lookup function won’t be an RTD function, but will update every time the handle updates due to the dependency in the formula.
-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 post to this group, send email to exce...@googlegroups.com.
Visit this group at http://groups.google.com/group/exceldna.
For more options, visit https://groups.google.com/d/optout.
public static object SubscribePriceRtd(int uic,string assetType)
{
return XlCall.Excel(XlCall.xlfEvaluate,ParseData(uic,assetType));
}
public static object ParseData(int uic,string assetType)
{
return (XlCall.RTD("Excel.RTDServers.PriceSubscriptionRtd", null,
new[] {uic.ToString(CultureInfo.InvariantCulture), assetType}));
}namespace Excel.RTDServers
{
public class PriceSubscriptionRtd : ExcelRtdServer
{
private Timer timer;
public PriceSubscriptionRtd()
{
timer=new Timer();
timer.Interval = 9000;
timer.Elapsed += timer_Elapsed;
timer.Start();
}
void timer_Elapsed(object sender, ElapsedEventArgs e)
{
var ran = new Random();
var first = ran.Next(2000);
var second = ran.Next(1000);
var value = "{" + first + "," + second + "}";
UpdateTopic(value);
}
private readonly List<Topic> topics = new List<Topic>();
protected override object ConnectData(Topic topic, IList<string> topicInfo, ref bool newValues)
{
topics.Add(topic);
return "{0,0}";
}
protected override void DisconnectData(Topic topic)
{
topics.Remove(topic);
base.DisconnectData(topic);
}
public void UpdateTopic(string value)
{
foreach (var topic in topics)
{
topic.UpdateValue(value);
}
}
}
}Do you have some issue?